![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com