views:

24

answers:

1

I have an access form that creates a ppt file (set of slides) from the information in the access form/tables. I use a template file in a utility folder that is in the same folder as the access file itself. everything works fine, except one little piece.

I would like to know how after I have ran through everything else in the sub routine that creates the ppt, how I can cause the newly created ppt file to prompt to save the file as something else besides template.ppt.

i think something like

   ppt.save

works. however i need something that prompts like a "save as"...and even the default that goes in there if possible.

thanks very much....i was not able to luckily stumble across this one.

justin

+2  A: 

How about:

Dim dlgSaveAs As FileDialog
Dim strMyFile As String

Set dlgSaveAs = Application.FileDialog(fileDialogType:=msoFileDialogSaveAs)
With dlgSaveAs
    .InitialFileName = "Presentation2_" & Format(Date, "yyyy-mm-dd")
    If .Show = -1 Then
        strMyFile = .SelectedItems(1)
        MsgBox strMyFile
        ''-- save your file to strMyFile here
    ''Else
        ''-- The user pressed Cancel.
    End If
End With
Set dlgSaveAs = Nothing

From: http://www.vbforums.com/showthread.php?t=521968

Remou
thanks Remou....one question though. FileDialog is actually coming up as a user type when i declare it, so i am getting a compile error. is there a reference library i need to set for this? thanks as always.
Justin
Yes, you have to have the Office library for the type library so the msoFileDialogSaveAs constant is defined. If you want to avoid that (and you should), just find out the value of msoFileDialogSaveAs and then create your own constant with that value (I think that's better than just hard-coding the value of the constant when you use it).
David-W-Fenton