![]() |
VBA Code Question
Hello:
I have a macro that opens a specific file. I want the macro to open any filename that I specify in a popup box. Does anyone know how I can accomplish this? Any help would be great. Thanks |
VBA Code Question
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Theresa" wrote in message ... Hello: I have a macro that opens a specific file. I want the macro to open any filename that I specify in a popup box. Does anyone know how I can accomplish this? Any help would be great. Thanks |
VBA Code Question
Theresa,
Something like sName = Inputbox("Please supply filename") Workbooks.Open Filename:=sName -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Theresa" wrote in message ... Hello: I have a macro that opens a specific file. I want the macro to open any filename that I specify in a popup box. Does anyone know how I can accomplish this? Any help would be great. Thanks |
VBA Code Question
Theresa,
Try something like the following: Dim FName As Variant FName = Application.GetOpenFilename("Excel files (*.xls),*.xls") If FName = False Then ' user clicked cancel Else Workbooks.Open FName End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Theresa" wrote in message ... Hello: I have a macro that opens a specific file. I want the macro to open any filename that I specify in a popup box. Does anyone know how I can accomplish this? Any help would be great. Thanks |
VBA Code Question
Try this with GetOpenFilename
Sub testing() Dim FName As Variant Dim N As Long Dim S As String FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls", _ MultiSelect:=True) If IsArray(FName) Then For N = LBound(FName) To UBound(FName) Workbooks.Open (FName(N)) Next End If End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Theresa" wrote in message ... Hello: I have a macro that opens a specific file. I want the macro to open any filename that I specify in a popup box. Does anyone know how I can accomplish this? Any help would be great. Thanks |
VBA Code Question
Chdrive "C"
ChDir "C:\My Folder" fName = Application.GetOpenFilename() if fName < false then workbooks.open fName End Sub -- Regards, Tom Ogilvy "Theresa" wrote in message ... Hello: I have a macro that opens a specific file. I want the macro to open any filename that I specify in a popup box. Does anyone know how I can accomplish this? Any help would be great. Thanks |
VBA Code Question
Hi Theresa,
Try this code at the top of of your macro and it should allow you to open up any file as it prompts you to select the file you want to use. So just incase you don't remeber the name of the file. Excel will do an open file function and you can pick the file you want. myFile = Application.GetOpenFilename("Excel Files, *.xls") Hope it works and good luck. Oli *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 05:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com