Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
need macro from button to open selectable file
i have a program that will export data to excel (text only). i am trying to
make a file which contains only a button that launches a macro that begins by allowing the user to select the file to which they exported the data, then the macro will change the formatting of the selected file. i have the macro saved in my personal macro workbook that does the formatting, and i can create the button on a new page, but i do not know how to get from pressing the button to opening a user selected file and then running the formatting. thanks in advance. dillon |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
need macro from button to open selectable file
Hi
If the file you want to select and use your formatting on, this should do it: Private Sub CommandButton1_Click() MyFileName = Application.GetOpenFilename Set wb1 = Workbooks.Open(MyFileName) wb1.Activate Call MyFormatSub wb1.Save wb1.Close Set wb1 = Nothing End Sub Hopes this helps. --- Per "dillon26" skrev i meddelelsen ... i have a program that will export data to excel (text only). i am trying to make a file which contains only a button that launches a macro that begins by allowing the user to select the file to which they exported the data, then the macro will change the formatting of the selected file. i have the macro saved in my personal macro workbook that does the formatting, and i can create the button on a new page, but i do not know how to get from pressing the button to opening a user selected file and then running the formatting. thanks in advance. dillon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to run on file open | Excel Discussion (Misc queries) | |||
how to get a button added to a speardsheet to open another file? | Excel Discussion (Misc queries) | |||
Open File within a macro | Excel Discussion (Misc queries) | |||
Favourites button - File Open dialog box | Excel Discussion (Misc queries) | |||
Button fails to call macro when open an Excel via Intranet | Excel Discussion (Misc queries) |