Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default 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
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
Problem using obj.Namespace(sourceFileName) Namespace(DestinationFilename).Itemsand then opening the xls file which creates a Temp Folder inside Temp Yuvraj Excel Discussion (Misc queries) 3 May 3rd 09 11:59 AM
Excel 2007 macro gets workbook name and path from temp file BothFeet Excel Programming 4 June 14th 08 09:05 PM
Original Excel File gets deleted and temp file gets created. Sandy[_7_] Excel Programming 11 December 12th 06 01:31 AM
shared workbook, local temp-file and network traffic petri Excel Discussion (Misc queries) 0 September 12th 05 10:51 PM
Cant Select temp Sheet ExcelMonkey[_190_] Excel Programming 1 March 16th 05 05:14 PM


All times are GMT +1. The time now is 03:51 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"