Open Window Explorer and set selected file to variable

zoog25

Active Member
Joined
Nov 21, 2011
Messages
418
Hello all,

Here is a question i have for an issue I'm dealing with. I have a macro that fills in text boxes in a word document. I just found out that for some reason, I have several people who have had issues get the program to open up the file. Several items its just that someone has moved the file to a different location and for a few i found out that they have different drive lettering for the shared drive. My thought solution was that when the macro tries to open the file. If there is an error than there should be a windows explorer window pop open and have the user navigate to the file and then open said file they need. How would i go about doing that and have the file location/name be recorded to a variable. The code below is what I'm currently doing. I just need that code to add in to make this work.

VBA Code:
wfile = "G:\Agreements\Improvement.Agr-2Party.docx"

If Dir(wfile) <> "" Then
    Wordapp.Documents.Open (wfile)
    Wordapp.Visible = True
Else
    MsgBox "Link to file is missing, please use explorer window to select the Improvement.Agr-2Party document "
    'wfile = 'Here is where the window explorer code will go'
    Wordapp.Documents.Open (wfile)
    Wordapp.Visible = True
End If
 
OK but the confusing part is that the reference library list is part of the workbook. It is not a local machine setting.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Well for whatever reason, I've had issues in which I've taken my stuff to a different machine and none of the reference libraries are selected. I'm not sure why.
 
Upvote 0
Very odd, that one may need its own thread!
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

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