Macro to open File Explorer and have me choose which document to open

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

So I need i macro to do the following

when run open the file explorer window,
Goto the folder in activesheet D12,
and show me all XLSX docs.
ask me to choose file to open
If i choose a file it opens that document and saves the name of the document in activesheet D20

if its closed without choosing or cancel is pressed I get a message saying No Document chosen.

please help if yoiu can

Thanks

Tony
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
For example:
VBA Code:
Dim WriteTo As Worksheet

Set WriteTo = ThisWorkbook.ActiveSheet
With Application.FileDialog(msoFileDialogFilePicker)
    .InitialFileName = ActiveSheet.Ramge("D12").Value
    .Title = "Select Folder and File"
    .AllowMultiSelect = False
    .Filters.Clear
    .Filters.Add "Excel", "*.xlsx", 1   '<<< Enabled extension(s)
    .Show
    If .SelectedItems.Count = 0 Then
         MsgBox ("No file selected, the procedure is aborted")
         Exit Sub
    End If
    FullNome = .SelectedItems(1)      'Directory + Name
End With
Workbooks.Open FullNome
WriteTo.Range("D20").Value = ActiveWorkbook.Name

Bye
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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