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

I'm trying to put into Excel a procedure that I have put into Word
(through the assistance of Greg Maxey). There seems to be two issues:
making some procedure operate by default, and using the correct code.

For the first problem, I followed the online help and tried to put the
code in a workbook and then saved the workbook as
\\%userprofile%\application data\microsoft\templates\book.xlt . When
that did not work, I saved it as c:\program files\microsoft
office\office11\xlstart\book.xlt . That did not work either, so I
don't know if the process was incorrect or if the code--which is
verbatim the same as I used in Word--is incorrect (since I know next to
nothing about VBA), or something else is incorrect.

Here's the code I used:

Sub AutoOpen()
If ActiveDocument.BuiltInDocumentProperties("Title") = "" Then
With Dialogs(wdDialogFileSummaryInfo)
.Show
End With
End If
End Sub

Sub AutoClose()
If ActiveDocument.BuiltInDocumentProperties("Title") = "" Then
With Dialogs(wdDialogFileSummaryInfo)
.Show
End With
End If
End Sub

So... can anyone point me in the right direction on making Excel
always prompt for a Title if the Title properties field is blank? (And
the reason I need it on both open and close has to do with automatic
document creation generated sometimes by a different program.)

TIA

 
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:42 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"