LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default How do I determine if a workbook is a template?

Prob'ly oughta post the solution I found:

The code in the template saves it as *.xls. Problem is, XL didn't recognize
it as a regular workbook, still as a template. Had to add this to the SaveAs:

ThisWorkbook.SaveAs _
Filename:=fname _
password:="xxxxxx" _
FileFormat:=xlWorkbookNormal

The last parameter is what makes XL recognize it as a "normal" workbook.

Then, at the top of the code, I added this line:

If ThisWorkbook.FileFormat < xlTemplate Then Exit Sub

Voila! The code won't be executed if it's not a template!

I'm outtahere!
--
Adios,
Clay Harryman


"Clayman" wrote:

I have code that needs only execute when a template is opened. The code saves
the template as .xls, and in that state the code should not execute. I
thought about deleting the code when the template is saved as a sheet,
--
Adios,
Clay Harryman

 
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
Determine if a workbook is already open [email protected] Excel Programming 6 February 28th 07 04:05 PM
Template track phone traffic to determine weekly, monthly trends. JKPierce New Users to Excel 0 April 6th 06 04:31 PM
How do I determine how many pages my excel workbook is? RP2chil Excel Discussion (Misc queries) 1 September 3rd 05 03:38 AM
How can I determine who has workbook open? Dean Hinson[_3_] Excel Programming 3 April 20th 05 04:01 PM
Determine if a workbook is shared quartz Excel Programming 3 March 2nd 04 10:23 PM


All times are GMT +1. The time now is 04:24 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"