Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about recording a macro when you do it once manually?
Then you could edit that macro to make it more generic. When you recorded your macro, you got something that looked like: Option Explicit Sub Macro1() Workbooks.Open Filename:="C:\My Documents\excel\book2.xls" End Sub Well, instead of having your filename in the code, you can give the user a chance to pick it themselves (take a look at getopenfilename in VBA's help): Sub macro1A() Dim myFileName As Variant myFileName = Application.GetOpenFilename(filefilter:="Excel files, *.xls", _ Title:="Pick a File") If myFileName = False Then MsgBox "Ok, try later" 'user hit cancel Exit Sub End If Workbooks.Open Filename:=myFileName '....rest of recorded code here! End Sub "ktpack <" wrote: top. Can no one help with this? --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need macro from button to open selectable file | Excel Worksheet Functions | |||
how to get a button added to a speardsheet to open another file? | Excel Discussion (Misc queries) | |||
button to open a file | Excel Programming | |||
Create button to open a file | Excel Programming | |||
VBA - on a button event, open another closed file, post changes, close file | Excel Programming |