Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2007 sheet returns workbook.name as temp file.
I have Office 2003 with compatibility pack installed on my machine and add-in
written for excel in C#.NET. In this add-in, On App_WorkbookOpen event, i want to get name and fullname of the workbook. For example: string sFileName = theworkbook.Name; string sFullFilePath = theworkbook.FullName; When opening 2007 workbooks, my addin gets the name of the temp files! So workbook.name, workbook.fullname and workbook.path all point to the .tmp file. This works correctly for any pre-2007 workbooks. Is there a way around this? Thanks and Regards Sharad |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2007 sheet returns workbook.name as temp file.
I believe this is a function of the file conversion process that is done by
the compatibility pack. The last time I was working with the compatibility pack I had similar problems. I used code like this to test if the workbook was a converted temp file If LCase(ThisWorkbook.Name) Like "xl???????.xls" Then You might be able to bypass the problem by saving in 2007 as .xls, or by trapping the Save event in 2007 and storing the workbook name in a Defined Name, or by doing a SaveAs in 2003 Charles __________________________________________________ The Excel Calculation Site http://www.decisionmodels.com "Sharad Birajdar" wrote in message ... I have Office 2003 with compatibility pack installed on my machine and add-in written for excel in C#.NET. In this add-in, On App_WorkbookOpen event, i want to get name and fullname of the workbook. For example: string sFileName = theworkbook.Name; string sFullFilePath = theworkbook.FullName; When opening 2007 workbooks, my addin gets the name of the temp files! So workbook.name, workbook.fullname and workbook.path all point to the .tmp file. This works correctly for any pre-2007 workbooks. Is there a way around this? Thanks and Regards Sharad |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2007 sheet returns workbook.name as temp file.
Charles,
Thanks for your reply. My workbook is in *.xlsm format and which can not be changed. Niether, I can "save" or "saveAs" this sheet as I do in-memory processing of excel sheets using my C# addin. Do you have any idea if I can wait till the sheet gets completly converted? And what shall I do if I didnt get format as "*.xlsm"? I want a way by which I will surely get fullname/Name of workbook. Thanks for your help. Regards Sharad "Charles Williams" wrote: I believe this is a function of the file conversion process that is done by the compatibility pack. The last time I was working with the compatibility pack I had similar problems. I used code like this to test if the workbook was a converted temp file If LCase(ThisWorkbook.Name) Like "xl???????.xls" Then You might be able to bypass the problem by saving in 2007 as .xls, or by trapping the Save event in 2007 and storing the workbook name in a Defined Name, or by doing a SaveAs in 2003 Charles __________________________________________________ The Excel Calculation Site http://www.decisionmodels.com "Sharad Birajdar" wrote in message ... I have Office 2003 with compatibility pack installed on my machine and add-in written for excel in C#.NET. In this add-in, On App_WorkbookOpen event, i want to get name and fullname of the workbook. For example: string sFileName = theworkbook.Name; string sFullFilePath = theworkbook.FullName; When opening 2007 workbooks, my addin gets the name of the temp files! So workbook.name, workbook.fullname and workbook.path all point to the .tmp file. This works correctly for any pre-2007 workbooks. Is there a way around this? Thanks and Regards Sharad |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel2007 sheet returns workbook.name as temp file.
Hi Sharad,
try the c# equivalent of this code in your Workbook_Open event Application.OnTime Now + TimeValue("00:00:01"), "GetName" where GetName gets the workbook.Name etc. But if you are doing in-memory processing why do you need the workbook name? Can't you just use an object variable that points to the workbook? regards Charles __________________________________________________ The Excel Calculation Site http://www.decisionmodels.com "Sharad Birajdar" wrote in message ... Charles, Thanks for your reply. My workbook is in *.xlsm format and which can not be changed. Niether, I can "save" or "saveAs" this sheet as I do in-memory processing of excel sheets using my C# addin. Do you have any idea if I can wait till the sheet gets completly converted? And what shall I do if I didnt get format as "*.xlsm"? I want a way by which I will surely get fullname/Name of workbook. Thanks for your help. Regards Sharad "Charles Williams" wrote: I believe this is a function of the file conversion process that is done by the compatibility pack. The last time I was working with the compatibility pack I had similar problems. I used code like this to test if the workbook was a converted temp file If LCase(ThisWorkbook.Name) Like "xl???????.xls" Then You might be able to bypass the problem by saving in 2007 as .xls, or by trapping the Save event in 2007 and storing the workbook name in a Defined Name, or by doing a SaveAs in 2003 Charles __________________________________________________ The Excel Calculation Site http://www.decisionmodels.com "Sharad Birajdar" wrote in message ... I have Office 2003 with compatibility pack installed on my machine and add-in written for excel in C#.NET. In this add-in, On App_WorkbookOpen event, i want to get name and fullname of the workbook. For example: string sFileName = theworkbook.Name; string sFullFilePath = theworkbook.FullName; When opening 2007 workbooks, my addin gets the name of the temp files! So workbook.name, workbook.fullname and workbook.path all point to the .tmp file. This works correctly for any pre-2007 workbooks. Is there a way around this? Thanks and Regards Sharad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem using obj.Namespace(sourceFileName) Namespace(DestinationFilename).Itemsand then opening the xls file which creates a Temp Folder inside Temp | Excel Discussion (Misc queries) | |||
Excel 2007 macro gets workbook name and path from temp file | Excel Programming | |||
Original Excel File gets deleted and temp file gets created. | Excel Programming | |||
shared workbook, local temp-file and network traffic | Excel Discussion (Misc queries) | |||
Cant Select temp Sheet | Excel Programming |