Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2006

Tip: Looking for answers? Try searching our database.

how do i make a commandbutton run a macro??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shax - 06 Jun 2006 21:20 GMT
I have this project i have to do for work and i want the commandbuttons to
open seperate sheets within the workbook - but i dont understand all this
visual basic language stuff so can someone please translate it into a dummy
version for me - i can run a macro by recording it but how do i make the
macro perform within the button??? i remember doing it in college but can not
rem think it was an older version - all help is appreciated.

thank you for ur time and many regards

:):)
RJ - 06 Jun 2006 21:31 GMT
There are a couple easy ways to do this. I guess the easiest would be to
right click on the command button and go to view code and insert the
following code.

Private Sub CommandButton1_Click()
Application.Run "YourWorkbookName!YourMacroName"
End Sub

Where YourWorkbookName will be the name of the workbook you are workign in
and the YourMacroName will be the name of the Macro you want the
commandbutton to open.

> I have this project i have to do for work and i want the commandbuttons to
> open seperate sheets within the workbook - but i dont understand all this
[quoted text clipped - 6 lines]
>
> :):)
Shax - 06 Jun 2006 23:03 GMT
tried that RJ and it says - run time error '1004' and that it failed - :( any
idea wot im doing wrong????
can u give me an example of wot the workbook name cud be?? its a case of -
the actual file name and the sheets from 1 to 9 all i need is to be able to
click the buttons to go to the relevant pages??
Don Guillett - 06 Jun 2006 23:09 GMT
Probably due to an error in the macro syntax. Post you coding efforts here
by copy/paste. I suggest using a button from the forms toolbar or a shape
from a the drawing toolbar instead of a command button.

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> tried that RJ and it says - run time error '1004' and that it failed -
> :( any
[quoted text clipped - 3 lines]
> to
> click the buttons to go to the relevant pages??
Shax - 06 Jun 2006 23:06 GMT
Private Sub CommandButton1_Click()
Application.Run "smart_pack!PERSONAL.XLS!Macro3"
End Sub

is this rite?? this is the command i put in?? smartpack the file name and
the macro??
i appreciate any help as is getting late and i want to make one of the
buttons to work before i go to bed to get my beauty sleep - lol?? (trust me i
need it!!!!)
Don Guillett - 06 Jun 2006 23:22 GMT
personal.xls is the file where your macro probably is
try
Application.Run "PERSONAL.XLS!macro3"

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> Private Sub CommandButton1_Click()
> Application.Run "smart_pack!PERSONAL.XLS!Macro3"
[quoted text clipped - 6 lines]
> me i
> need it!!!!)
RJ - 07 Jun 2006 01:34 GMT
Your workbook name is Personal.xls and your macro name is Macro3. Your code
should look like this.

Private Sub CommandButton1_Click()
Application.Run "PERSONAL.XLS!Macro3"
End Sub

> Private Sub CommandButton1_Click()
> Application.Run "smart_pack!PERSONAL.XLS!Macro3"
[quoted text clipped - 5 lines]
> buttons to work before i go to bed to get my beauty sleep - lol?? (trust me i
> need it!!!!)
Shax - 07 Jun 2006 17:16 GMT
think im gonna cry :) .................. it workedddd thankyou RJ and DON i
absolutely appreciate your help

take care
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.