xlDialogOpen.Show or Activeworkbook.Path?

M

Mike Echo

How can I get a dialog box to open in a certain location using VBA?

My problem happens when users press a button to automatically insert
data from a separate file - if they have been doing things using a
different path then Excel cannot find the data file. Is there an easy
way around this using Activeworkbook.Path or something? The data file is
located in the same directory as the main file.

(I know this group is called worksheet.functions but have found this
group very helpful in the past so please turn a blind eye to my OTness.)

TIA,
R.
 
H

Harald Staff

Hi R

Sub test()
Dim F As Variant
ChDrive ThisWorkbook.Path
ChDir ThisWorkbook.Path
F = Application.GetOpenFilename _
("Good stuff (*.xls), *.xls")
If F <> False Then MsgBox CStr(F)
End Sub

HTH. Best wishes Harald
 
M

Mike Echo

Sub test()
Dim F As Variant
ChDrive ThisWorkbook.Path
ChDir ThisWorkbook.Path
F = Application.GetOpenFilename _
("Good stuff (*.xls), *.xls")
If F <> False Then MsgBox CStr(F)
End Sub

HTH. Best wishes Harald

It does help - very much. Thank you Harald!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top