Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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
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
Modifying format for multiple comments in a workbook rmc Excel Discussion (Misc queries) 1 April 27th 09 04:13 PM
template in a shared workbook donnaK Excel Discussion (Misc queries) 0 November 7th 05 03:15 PM
Where is the WORKBOOK template stabilo Excel Discussion (Misc queries) 1 October 6th 05 04:39 PM
excel template/workbook trying@excel New Users to Excel 1 May 29th 05 01:28 AM
Master Workbook used as my template? tb New Users to Excel 4 March 10th 05 11:42 PM


All times are GMT +1. The time now is 04:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"