View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gizmo63 Gizmo63 is offline
external usenet poster
 
Posts: 43
Default Templates not loading as xls version

Thanks GS,
I'll take a look into the dialogue coding.
To answer your questions:
Protection is on to stop the template workbook being tampered with.
However, leaving protection (with p/w) on will stop the user from hiding
unwanted columns - a definate requirement.
A default .xls save is needed because any .xlt file opened through the Excel
"file-open" stays as a template and I can already envision users renaming but
failing to spot the file type as .xlt

"GS" wrote:

Possibly:

Code to open new workbook:
'open a new workbook from the .xlt
Workbooks.Add Template:="FullPathAndFilenameIncluding.xlt"
'this will be named whatever the workbook.xlt name is with a number suffix
added to it. The ".xls" extension will be added by Excel automatically.
'remove protection
ActiveWorkbook.Unprotect Password:="ThePassword"
'prompt user to save
Application.Dialogs(xlDialogSaveAs).Show
'the dialog will automatically filter ".xls" as the default file extension

If the workbook.xlt contains a single sheet, and you wish to 'Insert' that
sheet into an existing workbook, then replace the "Workbooks.Add..." line
with:

Worksheets.Add Type:="FullPathAndFilenameIncluding.xlt"

I'm not clear on why the protection is used, to only remove it right off the
bat and save the workbook unprotected.

Good luck!
GS