Templates not loading as xls version

G

Guest

Hi Folks,
I have created a p'word protected xlt workbook. When I open the file from
windows explorer it will open as an xls 'version' as it should. However most
users will use the excel file-open options to get the file which means it
stays as a template.
Can anyone help me out with some some VBA which is beyond my current
knowledge?

As soon as the template is loaded as read only I would like the file to
automatically remove the password and prompt the user to re-save under a new
name using the xls extension (selected for them as the save-as window stays
on xlt).

Hope this makes sense. Can this be done?
Your help appreciated.
 
G

Guest

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
 
G

Guest

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
 
G

Guest

Ok, so the protection is to preserve the integrity of the template. My
curiosity is satisfied, ..thanks for the feedback!

Regards,
GS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top