ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel2007 sheet returns workbook.name as temp file. (https://www.excelbanter.com/excel-programming/418876-excel2007-sheet-returns-workbook-name-temp-file.html)

Sharad Birajdar[_2_]

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








Charles Williams

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











Sharad Birajdar[_2_]

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












Charles Williams

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
















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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com