Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am opening a workbook using the following code:
Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you have workbook beforeclose or beforesave code that is changing the
name? look in ThisWorkbook code module. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "T Kirtley" wrote in message ... I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the reply. I don't recall any BeforeClose or BeforeSave events,
but the code was written a year ago and I may be forgetting something... I'll check tomorrow. "Bob Phillips" wrote: Do you have workbook beforeclose or beforesave code that is changing the name? look in ThisWorkbook code module. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "T Kirtley" wrote in message ... I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What's the name of the workbook that you're opening--it sounds like excel is
treating it as a template (*.xlt) workbook. In fact, make sure that you didn't save the workbook (strFullFileName) as a template with a .xls extension. T Kirtley wrote: I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the reply. The workbook is an xls file, and it behaves as expected
when opened manually, but when opened with vba it is acting just like a template. Funny thing is this was initially used as a template a year ago but the users wanted to work with it as a workbook so it was changed to an xls file. Could the one-time use as a template still be stored in some property? TK "Dave Peterson" wrote: What's the name of the workbook that you're opening--it sounds like excel is treating it as a template (*.xlt) workbook. In fact, make sure that you didn't save the workbook (strFullFileName) as a template with a .xls extension. T Kirtley wrote: I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I saved a workbook as a template, but with a .xls extension (I could have
renamed that file from *.xls to *.xlt) and excel was smart enough to use it as a template file. I'd open that workbook and do a file|SaveAs and make sure it was saved as a Normal workbook. Then test that out. T Kirtley wrote: Thanks for the reply. The workbook is an xls file, and it behaves as expected when opened manually, but when opened with vba it is acting just like a template. Funny thing is this was initially used as a template a year ago but the users wanted to work with it as a workbook so it was changed to an xls file. Could the one-time use as a template still be stored in some property? TK "Dave Peterson" wrote: What's the name of the workbook that you're opening--it sounds like excel is treating it as a template (*.xlt) workbook. In fact, make sure that you didn't save the workbook (strFullFileName) as a template with a .xls extension. T Kirtley wrote: I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK -- Dave Peterson -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I meant that I could have saved the file as a template (*.xlt), then renamed it
to *.xls. I reversed my extensions. Dave Peterson wrote: I saved a workbook as a template, but with a .xls extension (I could have renamed that file from *.xls to *.xlt) and excel was smart enough to use it as a template file. I'd open that workbook and do a file|SaveAs and make sure it was saved as a Normal workbook. Then test that out. T Kirtley wrote: Thanks for the reply. The workbook is an xls file, and it behaves as expected when opened manually, but when opened with vba it is acting just like a template. Funny thing is this was initially used as a template a year ago but the users wanted to work with it as a workbook so it was changed to an xls file. Could the one-time use as a template still be stored in some property? TK "Dave Peterson" wrote: What's the name of the workbook that you're opening--it sounds like excel is treating it as a template (*.xlt) workbook. In fact, make sure that you didn't save the workbook (strFullFileName) as a template with a .xls extension. T Kirtley wrote: I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK -- Dave Peterson -- Dave Peterson -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm pretty sure you are right that the file extension was just changed to
xls, and that it was not 'saved as' a workbook, at least not when initally changed from a template filetype... but I never thought there was anything to a template except the xlt extension. But I could believe that some hidden 'templatesque' property could remain intact unless 'saved as' a workbook again, but it is confusing that the workbook does open without name increment numbers when it is opened manually, either through the file menu or double-clicking in Windows. In any case this is definitely food for thought, and thanks for the suggestion. I'll give it a go tomorrow and see if saving as a workbook puts things right. Thanks, TK "Dave Peterson" wrote: I meant that I could have saved the file as a template (*.xlt), then renamed it to *.xls. I reversed my extensions. Dave Peterson wrote: I saved a workbook as a template, but with a .xls extension (I could have renamed that file from *.xls to *.xlt) and excel was smart enough to use it as a template file. I'd open that workbook and do a file|SaveAs and make sure it was saved as a Normal workbook. Then test that out. T Kirtley wrote: Thanks for the reply. The workbook is an xls file, and it behaves as expected when opened manually, but when opened with vba it is acting just like a template. Funny thing is this was initially used as a template a year ago but the users wanted to work with it as a workbook so it was changed to an xls file. Could the one-time use as a template still be stored in some property? TK "Dave Peterson" wrote: What's the name of the workbook that you're opening--it sounds like excel is treating it as a template (*.xlt) workbook. In fact, make sure that you didn't save the workbook (strFullFileName) as a template with a .xls extension. T Kirtley wrote: I am opening a workbook using the following code: Set wb = Workbooks.Open(strFullFileName, 0, False, , , , True) where strFullFileName is the full path and filename of a workbook. When the workbook opens, its name has an incremental suffix such as MyWorkbook12 if it is the 12th time the MyWorkbook file was opened. Unfortunately, this incremented name is what is used when the workbook is saved using a wb.save statement, causing multiple copies of the workbook to be created. What is causing this behavior? I suppose that there are cases where this behavior was desirable, but I need to open and resave the workbook with its original name. TIA for any help, TK -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Increment | Excel Worksheet Functions | |||
Automatically increment numbers in a cell when you open workbook | Excel Discussion (Misc queries) | |||
increment a value by 1 | New Users to Excel | |||
Increment/Increment letter in alphabetical order | Excel Programming | |||
how to auto increment a number each time i open the worksheet | Excel Worksheet Functions |