Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 macro gets workbook name and path from temp file

I have Office 2003 with compatibility pack installed. I have an
App_WorkbookOpen macro that gets the name and full path of any newly
opened workbook. This macro works correctly for any pre-2007
workbooks


When opening 2007 workbooks, the macro gets the name of the temp
files! So workbook.name, workbook.fullname and workbook.path all
point to the .tmp file.

Is there a way around this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Excel 2007 macro gets workbook name and path from temp file

Better post some code that duplicates the problem.

--
Jim
"BothFeet" wrote in message
...
|I have Office 2003 with compatibility pack installed. I have an
| App_WorkbookOpen macro that gets the name and full path of any newly
| opened workbook. This macro works correctly for any pre-2007
| workbooks
|
|
| When opening 2007 workbooks, the macro gets the name of the temp
| files! So workbook.name, workbook.fullname and workbook.path all
| point to the .tmp file.
|
| Is there a way around this?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 macro gets workbook name and path from temp file

Code in ThisWorkbook:

Option Explicit

Private WithEvents App As Application
Private Sub Workbook_Open()
Set App = Application
End Sub

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
MsgBox "workbook was opened: " & Wb.Name & vbCr & vbLf & _
", full name: " & Wb.FullName & vbCr & vbLf & _
" path: " & Wb.Path & vbCr & vbLf
End Sub


wb.fullname will return corrent name and path of workbook for Excel
2003 notebooks
returns .tmp file and path to temp directory for Excel 2007 notebooks.


On Jun 13, 10:45*am, BothFeet wrote:
I have Office 2003 with compatibility pack installed. * I have an
App_WorkbookOpen macro that gets the name and full path of any newly
opened workbook. *This macro works correctly for any pre-2007
workbooks

When opening 2007 workbooks, the macro gets the name of the temp
files! *So workbook.name, workbook.fullname and workbook.path all
point to the .tmp file.

Is there a way around this?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 macro gets workbook name and path from temp file

....... should also add, this code is in a Excel 2003 workbook that I
use for my add-ins. I first open this workbook with the code, then
any other workbooks I open get caught by the workbook open event .....

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Excel 2007 macro gets workbook name and path from temp file

Interesting. This is apparently a side-effect of the conversion process
that occurs when a 2007 workbook is opened in 2003. You could deal with it
by delaying getting the workbook name just a microsecond like this:

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
Application.OnTime Now, "Thisworkbook.ShowWBName"
End Sub

Sub ShowWBName()
MsgBox "workbook was opened: " & ActiveWorkbook.Name & vbCr & vbLf & _
", full name: " & ActiveWorkbook.FullName & vbCr & vbLf & _
" path: " & ActiveWorkbook.Path & vbCr & vbLf
End Sub

This assumes the opened workbook is the active workbook, which it would be
unless it was saved hidden like Personal.xls is.

--
Jim
"BothFeet" wrote in message
...
...... should also add, this code is in a Excel 2003 workbook that I
use for my add-ins. I first open this workbook with the code, then
any other workbooks I open get caught by the workbook open event .....





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
Excel 2007 - File Path location Kevin Excel Discussion (Misc queries) 1 September 26th 08 06:15 PM
Inserting File name and path in Excel 2007 Documents Christine Excel Discussion (Misc queries) 2 January 16th 08 12:11 AM
Excel 2007 add-in with file path showing Razzer204 Excel Discussion (Misc queries) 3 March 21st 07 04:24 PM
shared workbook, local temp-file and network traffic petri Excel Discussion (Misc queries) 0 September 12th 05 10:51 PM
Windows XP default path for temp file FCWL Excel Programming 0 September 25th 04 03:45 AM


All times are GMT +1. The time now is 12:17 AM.

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

About Us

"It's about Microsoft Excel"