p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Excel VBA > Excel VBA
I forgot my password Register Now
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 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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 4th, 2006, 10:04 AM
Friend of Wrox
Points: 1,449, Level: 15
Points: 1,449, Level: 15 Points: 1,449, Level: 15 Points: 1,449, Level: 15
Activity: 17%
Activity: 17% Activity: 17% Activity: 17%
 
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 4th, 2006, 10:27 AM
Friend of Wrox
Points: 360, Level: 6
Points: 360, Level: 6 Points: 360, Level: 6 Points: 360, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old January 4th, 2006, 10:37 AM
Authorized User
Points: 118, Level: 2
Points: 118, Level: 2 Points: 118, Level: 2 Points: 118, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 12:12 PM
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 04:39 AM
Excel in win 2000 to excel winxp (excel 2002) Max Excel VBA 3 August 28th, 2003 05:44 AM



All times are GMT -4. The time now is 07:41 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc