LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default VBA script on document open or close

Joseph,
I guess you are trying to replace the default Excel workbook that is created
when you click FileNew, click the New icon.
I seems to remember (when using Excel2000) altering the files "Book.xls" and
Sheet.xls" so all new WBs and WSs create incorporate these changes. However,
now I'm using Excel2002, I do not find these files on my system, so can't
tell you from which file(s) Excel generates these from, i.e. Excel
equivalent to Word's Normal.dot.

You can achieve the same result in code with Application level Events though
www.cpearson.com/excel/AppEvent.htm

NickHK

"Joseph N." wrote in message
ups.com...
Thanks Helmut. However, that code does not work for me.

I pasted it into the VB editor area of a workbook, making sure that it
was the workbook itself and not a template or add-in to which I was
adding the code. I digitally signed it with an accepted certificate,
since my macro security is set to "high," then I saved the workbook as
book.xlt . Following Microsoft's instructions, I first saved it in the
location of my templates, but that didn't work. Then I tried saving it
in the program's folder for startup templates, and that didn't work.
Two problems occurred: first, new workbooks did not adopt that .xlt
file as a template. Second, even when I pasted that code into a
workbook, it did not display the desired behavior. I am using Office
2003 with all updates. Any idea what could be the problem?

JN

Helmut Weber wrote:
This one works for me:

Sub auto_close()
If ThisWorkbook.BuiltinDocumentProperties("Title") = "" Then
Application.Dialogs(xlDialogSummaryInfo).Show
End If
End Sub

Sub auto_open()
If ThisWorkbook.BuiltinDocumentProperties("Title") = "" Then
Application.Dialogs(xlDialogSummaryInfo).Show
End If
End Sub




 
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
Excel 2003 + script to open and automatically close an excel workb Neil Holden Excel Discussion (Misc queries) 1 March 4th 10 04:57 PM
Open an Excel document in 2007 document using the 2003 office Peter Excel Programming 1 October 23rd 06 06:41 PM
Can I protect a document and still open / close groups Paul Excel Worksheet Functions 1 September 25th 06 06:47 PM
Disabling Document AutoRecovery in Excel by script Sedgwick Excel Discussion (Misc queries) 4 July 21st 06 05:47 AM
Use VB in Excel to close open Word Document Gary Excel Programming 2 March 3rd 06 02:47 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"