Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -- 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA code question | Excel Discussion (Misc queries) | |||
vb code question | Excel Discussion (Misc queries) | |||
vb code question | Excel Discussion (Misc queries) | |||
VB Code Question | Excel Discussion (Misc queries) | |||
VBA code question | Excel Discussion (Misc queries) |