Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modifying a Template from another Workbook
Thanks to help from this site, I was able to modify a Workbook from another
Workbook. Now I need to modify a Template from another Workbook. The problem I have is that when the Template is opened, it is opened as a .xls file with the number one following the Template name. This is expected behavior but I need to open the template, modify it as a template, and save it again with the same template name programatically. I cannot have the Save As dialog box poping up. I need all this to happen by clicking a button and no further user action. Here is the code I use that causes the Save As box to pop up: Set wb = Application.Workbooks.Open("C:\Templates\Test.xlt" ) wb.Sheets("Sheet1").Select wb.Sheets("Sheet1").Range("A4").Offset(-1, 0).Select Selection.Insert Shift:=xlDown Selection.Value = "New Comment 3" wb.Close True Set wb = Nothing -- Any help is greatly appreciated Robert Hill |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Modifying a Template from another Workbook
The only way that I have ever been able to open a file, change it and then
close it under a different name than the one shown in the title bar, is with Save As. Then if I try to save it as a file name that already exists, it will give me a message that asks if I want to overwrite the existing file. I guess what I am saying is, I don't think you can do what you are trying to do programmatically, unless you want to 1) Save the file as modified with the dash number. 2) Programmatically delete the template file without the dash 3) Programmatically rename the dash number file to the template file name. Even then, when the user pulls up the template and uses it, they will get a SaveAs dialog box before closing unless they save it as the dash number. "Robert" wrote: Thanks to help from this site, I was able to modify a Workbook from another Workbook. Now I need to modify a Template from another Workbook. The problem I have is that when the Template is opened, it is opened as a .xls file with the number one following the Template name. This is expected behavior but I need to open the template, modify it as a template, and save it again with the same template name programatically. I cannot have the Save As dialog box poping up. I need all this to happen by clicking a button and no further user action. Here is the code I use that causes the Save As box to pop up: Set wb = Application.Workbooks.Open("C:\Templates\Test.xlt" ) wb.Sheets("Sheet1").Select wb.Sheets("Sheet1").Range("A4").Offset(-1, 0).Select Selection.Insert Shift:=xlDown Selection.Value = "New Comment 3" wb.Close True Set wb = Nothing -- Any help is greatly appreciated Robert Hill |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Modifying format for multiple comments in a workbook | Excel Discussion (Misc queries) | |||
template in a shared workbook | Excel Discussion (Misc queries) | |||
Where is the WORKBOOK template | Excel Discussion (Misc queries) | |||
excel template/workbook | New Users to Excel | |||
Master Workbook used as my template? | New Users to Excel |