Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,533
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to run on file open Marie Bayes Excel Discussion (Misc queries) 17 November 5th 08 07:47 PM
how to get a button added to a speardsheet to open another file? RS Excel Discussion (Misc queries) 1 April 10th 08 04:39 PM
Open File within a macro Rob Excel Discussion (Misc queries) 10 June 29th 06 08:55 PM
Favourites button - File Open dialog box Aussie CPA Excel Discussion (Misc queries) 1 August 11th 05 02:42 PM
Button fails to call macro when open an Excel via Intranet tigertax Excel Discussion (Misc queries) 1 April 12th 05 10:21 AM


All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"