|
|
 |
| Excel VBA Discuss using VBA for Excel programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Excel VBA section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

January 4th, 2006, 10:04 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 Posts
|
|
Auto_Open in Excel Template
Hi All
Auto_Open works well with Excel Workbooks (*.xls). However, when this is applied to Excel templates, it does not get fired when the template is added as an add-in. Is there any other event that gets fired when the template is added.
Shasur
|

January 4th, 2006, 10:27 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Location: Bournemouth, Dorset, United Kingdom.
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have just tested the following three types of events...
In all 3 scenarios I have the following code in the workbook object.
Private Sub Workbook_Open()
MsgBox ("Boo")
End Sub
Scenario 1
save the workbook (xls), close it and re-open it. You may be asked to enable the macro. do so and you will get a message box with Boo appear on screen.
Scenario 2
save the workbook as a template (xlt)., close it and goto file new then select the template from the shown items. You may be asked to enable the macro. do so and you will get a message box with Boo appear on screen.
Scenario 3
Save as xla Xl Add-in. Place it somewhere convenient e.g. my docs. close the file. open ablank workbook and goto tools add-ins - [Browse] to locate the xls file. Click ok to accept and you will see the msgbox appear.
Which of these you want I dont know. but I suggest the third as it sounds closest to the example you gave.
cheers
Matt
|

January 4th, 2006, 10:37 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the Workbook event you're looking for is the AddinInstall event - it gets called when the workbook is installed as an addin
in the VB ide, double-click the special "ThisWorkbook" class of your project, and then select the built-in Workbook object from the list in the top-left combo box. In the top-right drop-down you'll see listed all the events that you can capture for the Workbook object
similarly, you may want to think about moving away from the Auto_Open macro procedure and using the Workbook's "Open" event instead
check the on-line help, or search the web - there are plenty of examples there
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |