Save As dialog box on screen

J

jesseb

Need help.
My user needs to save email to a folder on the network as a PDF.
She has Acrobat, so the ability to save as PDF is there. The Save As dialog
box needs to pop up so she can pick file type.

I have some code to save the open email but the problem is I can not get the
right code to open the Save As dialog box on the screen so she can pick file
type as PDF.
Or the code that would change the File type to PDF.

Sub SaveAsPDF_OLD()
Dim myItem As Outlook.Inspector
Dim objItem As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector
'If Not TypeName(myItem) = "Nothing" Then
Set objItem = myItem.CurrentItem
strname = objItem.Subject
objItem.SaveAsdialog ' "C:\" & strname & ".txt", oltxt
End Sub


Any help out there?
 
S

Sue Mosher [MVP]

You can't just make up your own method names, like SaveAsDialog. Look in the
object browser (F2 in VBA) to see what's available for each object. (And if
you do that with the SaveAs method, you'll see that it does not support any
constant for the 2nd argument that would allow for programmatically saving
an item as a PDF file.)

In this case, though, you won't find anything, because Outlook doesn't
expose a direct method for invoking that UI. It has to be done through the
CommandBars collection, as in this Outlook VBA procedure:

Sub ShowSaveAs()
Dim insp As Outlook.Inspector
Dim cbb As Office.CommandBarButton
Set insp = Application.ActiveInspector
If Not insp Is Nothing Then
Set cbb = insp.CommandBars.FindControl(, 748)
If Not cbb Is Nothing Then
cbb.Execute
End If
End If
Set insp = Nothing
Set cbb = Nothing
End Sub

This doesn't really get you very far, unfortunately, because she still has
to pick the path and save as type. The dialog can't be manipulated
programmatically, unless you want to try to code a SendKeys kludge.

FYI, you can use the Outlook VBA code sample at
http://www.outlookcode.com/codedetail.aspx?id=1507 to get the IDs, like 748
for Save As, that you need to be able to execute toolbar and menu commands.
Or use the Outlook Spy tool from http://www.dimastr.com/outspy/.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top