Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > App.Path in Excel


Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2003, 03:50 AM
Sathyaish Sathyaish is offline
Guest
 
Join Date: Jul 2003
Posts: 62
Default App.Path in Excel


What is the equivalant of App.Path in VBA programming with Excel? I've tried Me.Path inside the ThisWorkbook module, even tried Workbooks(1).Path but they all return vbNullString.
Reply With Quote
  #2  
Old 09-04-2003, 03:52 AM
Sathyaish Sathyaish is offline
Guest
 
Join Date: Jul 2003
Posts: 62
Default App.Path in Excel

What is the equivalant of App.Path in VBA programming with Excel? I've tried Me.Path inside the ThisWorkbook module, even tried Workbooks(1).Path but they all return vbNullString.
Reply With Quote
  #3  
Old 09-04-2003, 03:54 AM
Sathyaish Sathyaish is offline
Guest
 
Join Date: Jul 2003
Posts: 62
Default App.Path in Excel

What is the equivalant of App.Path in VBA programming with Excel? I've tried Me.Path inside the ThisWorkbook module, even tried Workbooks(1).Path but they all return vbNullString.
Reply With Quote
  #4  
Old 09-04-2003, 03:59 AM
PlenoJure's Avatar
PlenoJure PlenoJure is offline
'With Full Right'

Retired Moderator
* Guru *
 
Join Date: Jun 2003
Posts: 1,880
Default

Did you intend to post this 3 times?
Reply With Quote
  #5  
Old 09-04-2003, 04:01 AM
Sathyaish Sathyaish is offline
Guest
 
Join Date: Jul 2003
Posts: 62
Default

Nope! Not to the same forum.
Reply With Quote
  #6  
Old 09-04-2003, 04:02 AM
Grimfort Grimfort is offline
Centurion
 
Join Date: Sep 2000
Location: England
Posts: 133
Default

MsgBox Excel.ThisWorkbook.FullName



FullName Property
=========
Returns the name of the object, including its path on disk, as a string. Read-only String.

Remarks

This property is equivalent to the Path property, followed by the current file system separator, followed by the Name property.
Reply With Quote
  #7  
Old 09-04-2003, 04:07 AM
Sathyaish Sathyaish is offline
Guest
 
Join Date: Jul 2003
Posts: 62
Default

Two questions, I am trying to get this path in the Workbook_Open event, and it surprisingly gives me only the name of the Workbook file and not the entire path.

Secondly, how do I get the documentation for Excel, like the one you have just reproduced in your post. Any URL, I'd be grateful if you share it with me.
Reply With Quote
  #8  
Old 09-04-2003, 04:11 AM
Crittar's Avatar
Crittar Crittar is offline
Junior Contributor
 
Join Date: Jul 2003
Location: Somerset, England
Posts: 234
Default

From the excel vba help text:

This example displays the complete path to Microsoft Excel.

Sub TotalPath()

MsgBox "The path is " & Application.Path

End Sub

I haven't tried this but hope it helps
__________________
Chris Lawery
Reply With Quote
  #9  
Old 09-04-2003, 04:14 AM
Crittar's Avatar
Crittar Crittar is offline
Junior Contributor
 
Join Date: Jul 2003
Location: Somerset, England
Posts: 234
Default

From the excel vba help text:

This example displays the complete path to Microsoft Excel.

Sub TotalPath()

MsgBox "The path is " & Application.Path

End Sub
__________________
Chris Lawery
Reply With Quote
  #10  
Old 09-04-2003, 05:22 AM
Grimfort Grimfort is offline
Centurion
 
Join Date: Sep 2000
Location: England
Posts: 133
Default

Thats just the standard help file. Just visit Microsoft website, they wrote it after all .


http://support.microsoft.com/default.aspx?pr=xlw
Reply With Quote
  #11  
Old 09-04-2003, 06:11 AM
mark007's Avatar
mark007 mark007 is offline
Licensed to post

* Expert *
 
Join Date: Jul 2003
Location: York, Uk
Posts: 1,637
Default

Crittar is correct but I assume you are actually after the path to the workbook rather than the actual application path as the application path is fairly irrelevent. It that case:

me.path in the thisworkbook module or thisworkbook.path in any module is the code you want.

If you say this is returning a nullstring then I can only guess that the workbook has not been saved and so has no path.
Reply With Quote
  #12  
Old 09-04-2003, 06:22 AM
Sathyaish Sathyaish is offline
Guest
 
Join Date: Jul 2003
Posts: 62
Default

Mark, all our friends here are right, and so are you in saying that the Application.Path is irrelevant. I figured out where I was seeing stars. The file was saved but I was dealing in an Excel Template rather than a spreadsheet and did not expect the Template to behave differently, which it did.

I tried all these paths for a fresh spreadsheet and they all worked.

Anyway, I think I am going to use the GetModuleFileName API for this now.

Thanks for your time, friends!
Reply With Quote
  #13  
Old 09-04-2003, 09:14 AM
italkid's Avatar
italkid italkid is offline
Down...

Retired Moderator
* Expert *
 
Join Date: Dec 2002
Location: Belgium.
Posts: 6,731
Default

Use :
Code:
ThisWorkbook.Path 'or ActiveWorkbook.Path
Once saved you can use this method to get the workbook path.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6 and Excel wolrabs Excel 2 08-07-2003 03:26 PM
Sending a Stat Update Vinx Game Programming 13 03-25-2003 10:36 PM
PUblic array With images NeverMore5 Game Programming 3 02-07-2003 01:59 PM
Need help with public arrays NeverMore5 General 2 12-19-2002 10:06 PM
Excel crashing... Syko10-96 Word, PowerPoint, Outlook, and Other Office Products 12 11-17-2002 06:50 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->