Selecting file location

Julee

New Member
Joined
Aug 7, 2014
Messages
42
Dear guys,

I would like to enable a user of MS Access database to select the path under which to save the pdf file. While pressing a button, the box should appear with the possibility to choose different paths for this pdf file. How would it be possible to do this?

Thanks a lot!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Before you execute the save, you can get the path by runnin USERPICK1FILE()
REMEMBER YOU MUST ADD THE OFFICE LIBRARY in vbe menu, tools, references.

Code:
Public Sub PikFolder()
Dim vFile, vDir
vFile = UserPick1File()
vDir = Left(vFile, InStrRev(vFile, "\"))
MsgBox vDir
End Sub


Public Function UserPick1File()
Dim strTable As String
Dim strFilePath As String
Dim sDialog As String, sDecr  As String, sExt As String

'===================
'YOU MUST ADD REFERENCE : Microsoft Office ##.0 Object Library, in vbe menu, TOOLS, REFERENCES
'===================
With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = False
    .Title = "Locate a file to Import"
    .ButtonName = "SaveFolder"
    .Filters.Clear
    .Filters.Add "PDF Files", "*.pdf"
    '.Filters.Add "Excel Files", "*.xls;*.xlsx"
    .Filters.Add "All Files", "*.*"
    .InitialFileName = "c:\"
    .InitialView = msoFileDialogViewList    'msoFileDialogViewThumbnail
    
        If .Show = 0 Then
           'There is a problem
           Exit Function
        End If
    
    'Save the first file selected
    UserPick1File = Trim(.SelectedItems(1))
End With
End Function
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top