Locopete99
Registered User.
- Local time
- Yesterday, 16:10
- Joined
- Jul 11, 2016
- Messages
- 163
Hi Guys,
I have a query that could have multiple variations as the customer can put in a username as a criteria to produce different variations of the report.
I'm trying to get it to export using the Office File Dialog save as using instructions I have found online. I'm doing this as I want the user to be able save the report multiple times for each user in their department. I've added the Microsoft Office 16.0 Object Library.
The code I have is below. Once I click the button to run the code though, nothing happens. Can anyone see anything obvious that is stopping this from working?
I have a query that could have multiple variations as the customer can put in a username as a criteria to produce different variations of the report.
I'm trying to get it to export using the Office File Dialog save as using instructions I have found online. I'm doing this as I want the user to be able save the report multiple times for each user in their department. I've added the Microsoft Office 16.0 Object Library.
The code I have is below. Once I click the button to run the code though, nothing happens. Can anyone see anything obvious that is stopping this from working?
Code:
Private Sub Label1_Click()
Dim fd As FileDialog, filename As String
Set fd = Application.FileDialog(msoFileDialogSaveAs)
With fd
.Title = "Please Select the file to save."
Filters.Clear
Filters.Add "Excel Files", "*XLS*"
If fd.Show = True Then
If fd.SelectedItems(1) <> vbNullString Then
filename = fd.SelectedItems(1)
End If
Else
End Sub
End If
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "Qry_CLCN", filename, True
End Sub