Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 4th, 2006, 10:04 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default 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

__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #2 (permalink)  
Old 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
Default

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

Reply With Quote
  #3 (permalink)  
Old 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
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to multiple Excel files using template ecapox Access VBA 0 February 5th, 2008 10:38 AM
Access data to Excel Template Hamerw Access VBA 1 November 22nd, 2006 12:38 AM
calling one template in other template VijayKumar XSLT 3 September 15th, 2005 11:12 AM
How to export SQL RS data to Excel template johnilett BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 August 4th, 2005 03:39 AM
Excel in win 2000 to excel winxp (excel 2002) Max Excel VBA 3 August 28th, 2003 04:44 AM



All times are GMT -4. The time now is 01:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.