...you are still servicing an event for it. You COULD try to make the button invisible (.Visible = FALSE) without disabling it (after the FileDialog selection has been made) and THEN execute your save action. That way, the command button would technically be saved in the document but you would...
...suggestion will be easier for you, but I don't understand your point in post # 3. I every instance you will now exactly where each user just saved the file because you control the path (see your other post with using FileDialog), so just after the export happens you invoke the replace.
Cheers,
Simple example code:
Dim sFolder As String
Dim fd As FileDialog
Dim booResult As Boolean
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.AllowMultiSelect = False
fd.title = "Select folder"
While booResult = False
If fd.Show = True Then
'folder path was selected...
Ah, I just changed it to filedialog and intellisense changed it to FileDialog, so I thought it had been recognised.?
I already had Office 12 Library in my references.
Even after changing it to Office.FileDialog, they still stay at .filter? :)
...Dialog
Also, check your References to make sure you have
MS Office 16.0 Object Library as well as MS Access 16.0 Object Library
(or the versions matching your Access in use)
You should be able to locate all the above pretty easily online, for instance
search for open filedialog ms access
So, you need to get the filename from the filedialog? :unsure:
You pass in whatever folder and name you want in the first parameter?, second parameter should be 2 as you are using SaveAs
Then you take the result of the filedialog and put that into your transferspreadsheet?
The msoFileDialogOpen and msoFileDialogSaveAs constants are not supported in Microsoft Access.
https://docs.microsoft.com/en-us/office/vba/api/access.application.filedialog
Is there some built in like this for access ? Thank you!
IIRC, the old GetOpenFileName & GetSaveFileName don't work in 64-bit Access even if the APIs are correctly declared.
However, you can scrap it all and use much simpler code such as FileDialogFileDialog.Show method (Office) | Microsoft Docs
...files but here is a Public Function I have used to do that:
Public Function SelectBEFile()
On Error GoTo SelectBEFile_Error
Dim ConnectDataFileDialog As FileDialog
Set ConnectDataFileDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim SelectedFile As Variant
Dim tdf As DAO.TableDef...
...why in arrow #3, you can see the value of the variable (when you hover your mouse over it) is an empty string ("").
Also, you used the FileDialog object but never really assigned the filepath the user picked from the file browser to any variable. That's probably because you commented that...
...End Sub
Public Function AddAttachment(strTableName, strAttachField, strIDfield As String, i As Long, lngCertID As Long)
Dim fd As FileDialog
Dim oFD As Variant
Dim strFileName As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.ButtonName...
...the operator to browse for a file/folder.
' strStart specifies where the process should start the browser.
' lngType specifies the MsoFileDialogType to use.
' msoFileDialogOpen 1 Open dialog box.
' msoFileDialogSaveAs 2 Save As dialog box.
'...
...or table??? Or where does the file is stored using the code below??
Private Sub Command878_Click()
ChDir CurrentProject.Path
Dim ImportFileDialog As FileDialog
Set ImportFileDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim SelectedFile As Variant
Dim db As DAO.Database
Set db =...
...through a button on a Form. I have copied below code (forgot to copy the URL) for my use.
Am getting bug at below line.
'With Application.FileDialog(msoFileDialogFilePicker)'
I am getting bug as Method 'FileDialog' of object '_Application failed.
Can anyone please help me with this. Thanks...
...in Excel. Cleared the blank rows in Excel and re-tried, now the code is working fine.
Private Sub Select_File_Click()
Dim dlg As FileDialog
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
'+ Delete if table is already present in DB
tableName =...
...End Sub
Public Function AddAttachment(strTableName, strAttachField, strIDfield As String, i As Long, lngCertID As Long)
Dim fd As FileDialog
Dim oFD As Variant
Dim strFileName As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.ButtonName...
...As DAO.Field
Dim k As Integer, j As Integer
Dim strSource As String
Dim tbl As TableDef
Dim s As String
strSource = fFileDialogAns(msoFileDialogFilePicker, "", "", "Access Database", "*.accdb;*.mdb")
If strSource = "" Then Exit Function
'strSource =...
If in your set up generally, you have identified Foxit as the program associated with .pdf files, then
you may want to add a filter in your FileDialog
.Filters.Add "PDF Files", "*.pdf"
Here is a link to FileDialog documentation with example.
This does NOT allow you to manipulate (edit) the...