I learned that Dim wb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim iMsg As Object
Dim iConf As Object
' Dim Flds As Variant
Set wb = ActiveWorkbook
If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will be no VBA code in the file you send." & vbNewLine & _
"Save the file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Make a copy of the file/Mail it/Delete it
'If you want to change the file name then change only TempFileName
TempFilePath = Environ$("temp") & "\"
TempFileName = "Recycling Survey"
FileExtStr = "." & LCase(Right(wb.Name, Len(wb.Name) - InStrRev(wb.Name, ".", , 1)))
wb.SaveCopyAs TempFilePath & TempFileName & FileExtStr
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "blah@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "****"
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "blah@blah.com"
.CC = ""
.BCC = ""
.From = "blah@gmail.com"
.Subject = "Please see my recycling survey submission " & Date
.TextBody = ""
.AddAttachment TempFilePath & TempFileName & FileExtStr
.Send
End With
'If you not want to delete the file you send delete this line
Kill TempFilePath & TempFileName & FileExtStr
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
MsgBox ("Your survey form has been submitted")
is the value-at operator and *
the address-of operator. Formally known as dereferencing and referencing. Whenever I talk to someone I trip over the word dereferencing, because it reminds me of the word referencing and then I get confused. I know from how I learn that if I know what the de- prefix of dereference means I won't have this problem anymore.
In the same manner I learned what ante means in poker or what an antagonist and agonist is in neuroscience (and theater w.r.t. antagonist).
Another reason I trip up is because from my (limited) understanding the de- prefix in dereference seems to imply a deletion of a reference, which is not the case.
So what does de- mean? Is there a linguistic explanation or is it an ad-hoc prefix with no meaning other than differentiating from reference?
Possible duplicates: this question and this one but I'm not asking for the definition of dereferencing. I'm asking what the prefix means in the context of the word (edit: and also in the technical context, I'm not interested in dereferencing a real book, whatever that means).
答案 0 :(得分:3)
Not a linguist but here goes. First, from google:
de- a prefix occurring in loanwords from Latin ( decide); also used to indicate privation, removal, and separation ( dehumidify), negation ( demerit; derange), descent ( degrade; deduce), reversal ( detract), intensity ( decompound).
The remove(...)
prefix here means to negate what follows. Similar to an de-
prefix (do / undo). So when we use the un-
operator, we take a reference. When we use the &
operator, we *
reference. We undo the reference operator to get the variable again.
de-
== *(&foo)
: foo