ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoNew (https://www.excelbanter.com/excel-programming/346206-autonew.html)

Steve C

AutoNew
 
In Word, I've built templates containing a Sub AutoNew procedure where a
userform opens only when a new document is created from them. After that,
upon reopening the document, the form no longer shows.

Does Excel have an equivalent to AutoNew? I want users (when they choose
File New to create a new spreadsheet from a template) only to see a
userform the first time they use the template, not when subsequently
reopening the spreadsheet. Thanks!

Steve C

Dave Peterson

AutoNew
 
Not really.

But you could use Auto_open() and check to see if it's a template:

Option Explicit
sub Auto_open()
if thisworkbook.path < "" then
exit sub
end if
'do the real work
end sub

Steve C wrote:

In Word, I've built templates containing a Sub AutoNew procedure where a
userform opens only when a new document is created from them. After that,
upon reopening the document, the form no longer shows.

Does Excel have an equivalent to AutoNew? I want users (when they choose
File New to create a new spreadsheet from a template) only to see a
userform the first time they use the template, not when subsequently
reopening the spreadsheet. Thanks!

Steve C


--

Dave Peterson

Steve C

AutoNew
 
Thanks, Dave. That gives me a good work-around.

"Dave Peterson" wrote:

Not really.

But you could use Auto_open() and check to see if it's a template:

Option Explicit
sub Auto_open()
if thisworkbook.path < "" then
exit sub
end if
'do the real work
end sub

Steve C wrote:

In Word, I've built templates containing a Sub AutoNew procedure where a
userform opens only when a new document is created from them. After that,
upon reopening the document, the form no longer shows.

Does Excel have an equivalent to AutoNew? I want users (when they choose
File New to create a new spreadsheet from a template) only to see a
userform the first time they use the template, not when subsequently
reopening the spreadsheet. Thanks!

Steve C


--

Dave Peterson



All times are GMT +1. The time now is 03:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com