#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Calling SUB

Hi All,

I do not write a lot of VB so this will probably seem like a dumb question
but here goes.

I have written a sub routine ( in ThisWorkbook) which prints the sheets I
require in a workbook template. I now want to call this sub routine from a
button on a toolbar in my template.

Can anyone tell me how I can do this


TIA

Peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Calling SUB

Peter

First, move the sub from ThisWorkbook to a standard module (Insert - Module
if you don't have one yet). Then set the OnAction property of the
commandbarbutton to the name of the sub.

Unless you're using a Workbook level event, you probably don't need the sub
in ThisWorkbook.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Peter Longstaff" wrote in message
. ..
Hi All,

I do not write a lot of VB so this will probably seem like a dumb question
but here goes.

I have written a sub routine ( in ThisWorkbook) which prints the sheets I
require in a workbook template. I now want to call this sub routine from a
button on a toolbar in my template.

Can anyone tell me how I can do this


TIA

Peter



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Calling SUB

"Dick Kusleika" wrote in
:

Peter

First, move the sub from ThisWorkbook to a standard module (Insert -
Module if you don't have one yet). Then set the OnAction property of
the commandbarbutton to the name of the sub.

Unless you're using a Workbook level event, you probably don't need
the sub in ThisWorkbook.


Hi Dick,

that's done it.

Thank you
Peter
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
Calling a function in my SQL-DB from VBA KSor Excel Discussion (Misc queries) 0 March 11th 09 02:08 PM
HELP!!!! Calling a sub from Workbook_BeforeSave RocketMan[_2_] Excel Discussion (Misc queries) 4 May 31st 07 11:47 PM
Calling an Add-In BillCPA Excel Discussion (Misc queries) 2 August 11th 05 09:32 PM
Calling Solver from VBA Nick Excel Programming 0 September 16th 03 03:24 PM
Calling certain functions within VBA james Excel Programming 0 August 11th 03 10:27 PM


All times are GMT +1. The time now is 05:07 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"