Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Howto show a saveas dialog in outlook 1

Status
Not open for further replies.

sciencer

Technical User
Jan 7, 2004
17
NL
Hi

Can anyone tell me Howto show a saveas dialog in outlook?

Greetings Raymond
 
Hello,

I don't believe that you can in Outlook, but if you set a reference to Excel (leave it hidden) then you can use this:

Code:
With objMyExcel.Application
    .GetOpenFilename ([FileFilter], [FilterIndex], [Title], [ButtonText], [MultiSelect])
    .GetSaveAsFilename ([InitialFilename], [FileFilter], [FilterIndex], [Title], [ButtonText])

All of the above are optional parameters you can use. Hope this helps and Good Luck!

Have a great day!

j2consulting@yahoo.com
 
Hello Sciencer,

I thought I had some code laying around to do what you need. Just copy this code into your Outlook module and I think it will do what you need. By defining the Excel object as Object you don't have to set a reference to Excel as I told you to do in my prior post. good luck!

Code:
'GetOpenFilename([FileFilter], [FilterIndex], [Title], [ButtonText], [MultiSelect])
'GetSaveAsFilename([InitialFilename], [FileFilter], [FilterIndex], [Title], [ButtonText])
Sub ExcelFileDialogs(Optional ShowOpen As Boolean)
Dim FileName As Variant
    With CreateObject("Excel.Application")
        If ShowOpen Then
            FileName = .GetOpenFilename 
            If VarType(FileName) = vbBoolean Then
                MsgBox "User Cancelled"
            Else
                MsgBox FileName 'File/Path user selected
            End If
        Else
            FileName = .GetSaveAsFilename
            If VarType(FileName) = vbBoolean Then
                MsgBox "User Cancelled"
            Else
                MsgBox FileName 'File/Path as user saved it
            End If
        End If
    End With
End Sub

Have a great day!

j2consulting@yahoo.com
 
Can I also set a defualt directrory?

Raymond
 
Setting teh dircetory for the saveas dialog can you do if you reference to excel

and then use the fulling code
dim myolexcel as new Excel.appliaction

With MyOlExcel
Dircectory = .DefaultFilePath
.DefaultFilePath = PathAttach
FileName = .GetSaveAsFilename(, , , "Attachment save as")
If VarType(FileName) <> vbBoolean Then
MsgBox FileName
End If
.DefaultFilePath = Dircectory
End With

The last problem i've is to put the filenam of the attachment in the field where Filename of the dialog window

Does any one know how you can do that?

Greetings Raymond
 
I'm not sure of the exact syntax but check out the MailItem Attachment property. It would probably involve some combination of add and then set a property to the file name you retrieved from the dialog box. Good Luck!

Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top