Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, so the protection is to preserve the integrity of the template. My
curiosity is satisfied, ..thanks for the feedback! Regards, GS "Gizmo63" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I save an Excel 97-2003 version or 2007 version for Mac 200 | Excel Discussion (Misc queries) | |||
saved templates opening as templates | Excel Discussion (Misc queries) | |||
Wrap Text: Print Version different than Screen Version | Excel Discussion (Misc queries) | |||
Excel is opening templates as templates instead of as worksheets | Setting up and Configuration of Excel | |||
Recover earlier version of excel sheet after new version saved? | Excel Discussion (Misc queries) |