ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to use macro to open an specific file (https://www.excelbanter.com/excel-programming/312994-how-use-macro-open-specific-file.html)

Rafael Chang[_2_]

How to use macro to open an specific file
 
To anyone that can help me:

I need to create a macro that allows the user to select a specific file, no
matter what the name of the file is. Also, the file may be located anywhere.
In short, I want to enable the user to select the file in any directory
location, but, when it opens, has the restriction of the content validation.

Can someone give me a light?
Thank you!!

Kris

How to use macro to open an specific file
 
Hello Rafael,

To prompt the user for the file to open, use something
like:

Sub Macro1()

Dim myfile As String

myfile = Application.GetOpenFilename()
Workbooks.Open FileName:=myfile
End Sub

Look at the help in VBA for all of the valid options for
GetOpenFilename().

Not sure what you mean by "has the restriction of the
content validation" though.

Hope this helps,

Kris

-----Original Message-----
To anyone that can help me:

I need to create a macro that allows the user to select

a specific file, no
matter what the name of the file is. Also, the file may

be located anywhere.
In short, I want to enable the user to select the file

in any directory
location, but, when it opens, has the restriction of the

content validation.

Can someone give me a light?
Thank you!!
.



All times are GMT +1. The time now is 08:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com