I can't get this macro to work. i'm trying to save the email item that is open
to a file. I'm trying two alternatives, i.e., save to .txt and save to .html
Nothing gets saved, when I use the code line below ("objItem.SaveAs strname
& ".txt", olTXT") and I input "e:\Harvey" to the inputbox.
But when I use the code line below ("objItem.SaveAs strname & ".html",
olHTML), I get an error message: "Invalid procedure call or argument" and
the debugger highlights the line: "objItem.SaveAs strname & ".html", olHTML
Questions:
1. What am I doing wrong?
2. Where can I learn more about the issues I'm missing?
Thanks,
marceepoo
Sub SaveCurrentEmailItemAsTxtOrHtml()
'
'Cannibalized from:
http://msdn2.microsoft.com/en-us/library/bb175460(printer).aspx
'
Dim myItem As Outlook.Inspector
Dim objItem As Object
Dim strname, strPrompt, strUserInput As String
Set myItem = Application.ActiveInspector
If Not TypeName(myItem) = "Nothing" Then
Set objItem = myItem.CurrentItem
strname = objItem.Subject
'Prompt the user for confirmation
strPrompt = "Are you sure you want to save the item? " & _
"If a file with the same name already exists, " & _
"it will be overwritten with this copy of the file." & vbCrLf & _
" If you want to save it, input here the full path and file name,
" & _
"w/o quotation marks, and w/o the '.htm' extension: "
strUserInput = InputBox(strPrompt, "Save Email to File (HTML)", "")
objItem.SaveAs strname & ".txt", olTXT
' objItem.SaveAs strname & ".html", olHTML
Else
MsgBox "There is no current active inspector."
End If
End Sub
Archived from group: microsoft>public>office>developer>outlook>vba