Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Start macro by Command Button?

Hi
I would like to start a macro which open another excelfile, by clicking a
commandbutton.
Thanks for your help
KentÄ

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Start macro by Command Button?

drag a commandbutton to the worksheet.

double click on it

Private Sub Commandbutton1_click()
Workbooks.Open "C:\Myfolder\MyFile.xls"
End Sub

return to Excel

take the sheet out of design mode by clicking on the icon in the upper left
corner of the Control Toolbox Toolbar (which should appear depressed since
the sheet is in design mode)

--
Regards,
Tom Ogilvy


"KentÄ" wrote in message
...
Hi
I would like to start a macro which open another excelfile, by clicking a
commandbutton.
Thanks for your help
KentÄ



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Start macro by Command Button?

Thank's Tom
Sorry, but I want to run a macro (in Module StartUp) by clicking at the
Command Button.
The macro will open the file and execute futher commands.
Thank's for help in advance
Regards
KentÄ

"Tom Ogilvy" wrote:

drag a commandbutton to the worksheet.

double click on it

Private Sub Commandbutton1_click()
Workbooks.Open "C:\Myfolder\MyFile.xls"
End Sub

return to Excel

take the sheet out of design mode by clicking on the icon in the upper left
corner of the Control Toolbox Toolbar (which should appear depressed since
the sheet is in design mode)

--
Regards,
Tom Ogilvy


"KentÄ" wrote in message
...
Hi
I would like to start a macro which open another excelfile, by clicking a
commandbutton.
Thanks for your help
KentÄ




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Start macro by Command Button?

Private Sub Commandbutton1_click()
Startup.OpenBook
End Sub

in a module named Startup

Sub OpenBook()
Workbooks.Open "C:\Myfolder\MyFile.xls"
End sub


in the workbook that will be opend (MyFile.xls), use the Workbook_Open event

See Chip Pearson's page on events
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy


"KentÄ" wrote in message
...
Thank's Tom
Sorry, but I want to run a macro (in Module StartUp) by clicking at the
Command Button.
The macro will open the file and execute futher commands.
Thank's for help in advance
Regards
KentÄ

"Tom Ogilvy" wrote:

drag a commandbutton to the worksheet.

double click on it

Private Sub Commandbutton1_click()
Workbooks.Open "C:\Myfolder\MyFile.xls"
End Sub

return to Excel

take the sheet out of design mode by clicking on the icon in the upper

left
corner of the Control Toolbox Toolbar (which should appear depressed

since
the sheet is in design mode)

--
Regards,
Tom Ogilvy


"KentÄ" wrote in message
...
Hi
I would like to start a macro which open another excelfile, by

clicking a
commandbutton.
Thanks for your help
KentÄ






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Start macro by Command Button?

Thank's Tom!
It works perfect
Regards KentÄ

"Tom Ogilvy" skrev:

Private Sub Commandbutton1_click()
Startup.OpenBook
End Sub

in a module named Startup

Sub OpenBook()
Workbooks.Open "C:\Myfolder\MyFile.xls"
End sub


in the workbook that will be opend (MyFile.xls), use the Workbook_Open event

See Chip Pearson's page on events
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy


"KentÄ" wrote in message
...
Thank's Tom
Sorry, but I want to run a macro (in Module StartUp) by clicking at the
Command Button.
The macro will open the file and execute futher commands.
Thank's for help in advance
Regards
KentÄ

"Tom Ogilvy" wrote:

drag a commandbutton to the worksheet.

double click on it

Private Sub Commandbutton1_click()
Workbooks.Open "C:\Myfolder\MyFile.xls"
End Sub

return to Excel

take the sheet out of design mode by clicking on the icon in the upper

left
corner of the Control Toolbox Toolbar (which should appear depressed

since
the sheet is in design mode)

--
Regards,
Tom Ogilvy


"KentÄ" wrote in message
...
Hi
I would like to start a macro which open another excelfile, by

clicking a
commandbutton.
Thanks for your help
KentÄ









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
Use Macro To Change Which Macro Assigned To Command Button CVinje Excel Discussion (Misc queries) 0 May 25th 10 09:55 PM
Button will not start macro Clark Excel Worksheet Functions 2 August 21st 08 03:47 PM
Run Macro from Command Button [email protected] Excel Discussion (Misc queries) 1 April 23rd 07 04:36 PM
Start/Stop Macro Button Paul987 Excel Discussion (Misc queries) 1 July 10th 06 05:14 PM
Can't start macro via button click dan Excel Programming 1 November 3rd 04 08:48 PM


All times are GMT +1. The time now is 10:23 PM.

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

About Us

"It's about Microsoft Excel"