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
|