save prompt

spinkung

Registered User.
Local time
Today, 03:31
Joined
Dec 4, 2006
Messages
267
Hi All,

I have a button on a form which exports a query to excel.

i want to be able to give the user a prompt as to where the file should be saved instead of having it fixed in the code.

here's what im using...
Code:
'check file already exists and if so then delete it.
    pth = GetXcelPath & "Known Issues Export.xls"
    FileSystem.Dir pth
    If pth = Dir(pth) Then
        FileSystem.Kill pth
    End If
    
'output to excel
    DoCmd.OutputTo acOutputQuery, "query1", acFormatXLS, pth           'Enter table/query to be sent to excel
    
'open excel file
    OpenSpecific_xlFile (pth)

i want the user to be able to slect the save location. can anyone point me in the right direction??

Thanks.
 
ok, so i've found this

Code:
Dim dlgSaveAs As FileDialog

Set dlgSaveAs = Application.FileDialog(msoFileDialogSaveAs)
dlgSaveAs.Show
..how do i get the file they have saved into a variable so i can use it to pass the query to??

thanks. :)
 
Look at "DemoQToExNewPathA2000.mdb" (attachment, zip).
Open Form and try. Look at VBA.
 

Attachments

Users who are viewing this thread

Back
Top Bottom