Thread: Open File
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Open File

Pete,
Read up on the optional parameters to .Open in the help.

NickHK

"PraxisPete" wrote in message
...
Thanks for that Harald, a further development of that is, if all the files
that could be opened required the same password and were to be open as

read
only, can this be coded in?

Thank you again

"Harald Staff" wrote:

Sub test()
Dim F As Variant
Dim Myfolder As String
Myfolder = "C:\Temp"
ChDrive Myfolder
ChDir Myfolder

F = Application.GetOpenFilename("XL Files (*.xl*), *.XL*")
If F = False Then Exit Sub
Workbooks.Open F
End Sub

HTH. Best wishes Harald

"PraxisPete" skrev i melding
...
Hi, I am new to VB and can't find how to get my macro to open a file.

I
know
the location of the file but not the filename, I need the user to pick

which
file to open. Basically I need the VB to display Excel's Open Dialog

Box

Many thanks in advance