Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Connecting button to macro

OK this does not sound very difficult but I have a problem finding the
correct macro and how to connect it to the button. I have made a button from
the ViewToolbarsForms in Excel. Now I already have code that I have placed
in a Modul. The only thing I want the button to do is to call a bigger
program that is found in the modul when pressed. When I try to connect the
button to desierd macro I do not succed to find the macro in the lis nor do
any manual attempts work. Can someone please help me?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 268
Default Connecting button to macro

Right click on the button, click on View Code. You will see a procedure,
most likely called Button1_Click(), with a blank line below that, and in the
next line the words End Sub. In the blank line type in the name of the macro
you want to run. Return to your sheet, and click on the Design button to
exit Edit mode. If you click the button, it will run your macro.

"april27" wrote:

OK this does not sound very difficult but I have a problem finding the
correct macro and how to connect it to the button. I have made a button from
the ViewToolbarsForms in Excel. Now I already have code that I have placed
in a Modul. The only thing I want the button to do is to call a bigger
program that is found in the modul when pressed. When I try to connect the
button to desierd macro I do not succed to find the macro in the lis nor do
any manual attempts work. Can someone please help me?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Connecting button to macro

I coded a VBA Excel solution where a UserForm shows when the Workbook_Open
occurs. Once the process finishes successfully, the workbook stays open with
a button on the worksheet. It is in the worksheet, not the module, where
your code goes. So, for instance, my Workbook_Open is this:

Private Sub Workbook_Open()
UserForm_HSIsplash.Show
UserForm1.Show
End Sub

And the code for the button click on the Worksheet (I named the button
"showUserForm1") is this:

Private Sub showUserForm1_Click()
Call UserForm1.UserForm_Initialize
UserForm1.Show
End Sub

Hope this helps!

--
--Being powerful is like being a lady; if you have to tell people you are,
you aren''t. ~~Margaret Thatcher


"april27" wrote:

OK this does not sound very difficult but I have a problem finding the
correct macro and how to connect it to the button. I have made a button from
the ViewToolbarsForms in Excel. Now I already have code that I have placed
in a Modul. The only thing I want the button to do is to call a bigger
program that is found in the modul when pressed. When I try to connect the
button to desierd macro I do not succed to find the macro in the lis nor do
any manual attempts work. Can someone please help me?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Connecting button to macro

Hi

Are you able to run the macro with menu Tools Macro Run ? Which module
is the macro in ?

Best wishes Harald

"april27" skrev i melding
...
OK this does not sound very difficult but I have a problem finding the
correct macro and how to connect it to the button. I have made a button

from
the ViewToolbarsForms in Excel. Now I already have code that I have

placed
in a Modul. The only thing I want the button to do is to call a bigger
program that is found in the modul when pressed. When I try to connect the
button to desierd macro I do not succed to find the macro in the lis nor

do
any manual attempts work. Can someone please help me?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 268
Default Connecting button to macro

Press <Alt<F11 to go to VB. Find the macro you want to use, and remember
this name. It could be in a module of its own - Module 1 most likely, or in
This Workbook, or one of the worksheets. To move between these, double click
on the name in the left hand window, and you will see code if any in the
right hand window.
Also, you should use View Toolbars Control Toolbox to create a button. Once
you have the name of the macro, do as per my previous post.

Kassie
"april27" wrote:

OK this does not sound very difficult but I have a problem finding the
correct macro and how to connect it to the button. I have made a button from
the ViewToolbarsForms in Excel. Now I already have code that I have placed
in a Modul. The only thing I want the button to do is to call a bigger
program that is found in the modul when pressed. When I try to connect the
button to desierd macro I do not succed to find the macro in the lis nor do
any manual attempts work. Can someone please help me?

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
Excel in macro and connecting to a network drive question Mike S. Excel Discussion (Misc queries) 3 November 8th 08 02:51 AM
Macro Error When Connecting to Hidden Sheet Wuddus Excel Discussion (Misc queries) 5 August 3rd 06 03:34 PM
Can't select macro button after other button is pressed C. Campbell Excel Programming 1 November 30th 04 07:46 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM
Connecting to Access using macro onedaywhen Excel Programming 0 April 1st 04 04:18 PM


All times are GMT +1. The time now is 04:22 AM.

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"