Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All;
I'd like to list all open workbooks from my VC application. My first step was calling GetActiveObject; it returns a pointer to IUnknown interface for Excel Application. Now I can get the names of all loaded workbooks but I also need their paths (Excel10 on Windows XP). Thanks. Boba. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub listum()
For Each wb In Workbooks MsgBox (wb.Name & wb.Path) Next End Sub -- Gary''s Student - gsnu2007h |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Gary''s Student" wrote in message
... Sub listum() For Each wb In Workbooks MsgBox (wb.Name & wb.Path) Next End Sub -- Gary''s Student - gsnu2007h Thank you for your prompt answer, but what you suggest is VB (not VC) version - and my Automation application is written in C++. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 7, 1:18 pm, "Boba" wrote:
"Gary''s Student" wrote in message ... Sub listum() For Each wb In Workbooks MsgBox (wb.Name & wb.Path) Next End Sub -- Gary''s Student - gsnu2007h Thank you for your prompt answer, but what you suggest is VB (not VC) version - and my Automation application is written in C++. He gave you all you need to know, regardless of exact syntax. The point being, that however you are accessing the 'Names' of the workbooks, if you simply replace the Name property with the Path property, you have your answer, as in ... var sWBPath = yournamefortheWorkbookObject.Path; OK, is that C++ enough. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"T Lavedas" wrote in message
... He gave you all you need to know, regardless of exact syntax. The point being, that however you are accessing the 'Names' of the workbooks, if you simply replace the Name property with the Path property, you have your answer, as in ... var sWBPath = yournamefortheWorkbookObject.Path; OK, is that C++ enough. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ Hi, Tom; The problem is that the Path property also returns workbook name (not the file location). I suspect it might have smth to do with the fact that my VS is v.6 and is too old for XP. This may be a good time for update... |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 7, 1:57 pm, "Boba" wrote:
"T Lavedas" wrote in message ... He gave you all you need to know, regardless of exact syntax. The point being, that however you are accessing the 'Names' of the workbooks, if you simply replace the Name property with the Path property, you have your answer, as in ... var sWBPath = yournamefortheWorkbookObject.Path; OK, is that C++ enough. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ Hi, Tom; The problem is that the Path property also returns workbook name (not the file location). I suspect it might have smth to do with the fact that my VS is v.6 and is too old for XP. This may be a good time for update... No, I doubt that it has anything to do with version. It's jaut that Excel's definition (and some other interfaces, as well), interpret Path to mean the entire pathspec to the file, as opposed to the parent path to the folder that contains the file. You can either parse the path to remove the name or invoke the FSO and use the GetParentFolderName(path) method to do the parsing ... var oFSO = new ActiveXObject("Scripting.FileSystemObject"); var sWBPath = FSO.GetParentFolderName(yournamefortheWorkbookObje ct.Path); This is JScript syntax, not C++, and there may be an equivalent parser or another way to access the FSO, but hopefully it's close enough to give you the idea. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to see full path name of open workbook? | Excel Discussion (Misc queries) | |||
Obtain Path on open workbook | Excel Programming | |||
Open Workbook using URL instead of network path | Excel Programming | |||
Get path of open workbook | Excel Programming | |||
how to open workbook without hardcoding path | Excel Programming |