PC Review


Reply
Thread Tools Rate Thread

get current filepath in excel vba

 
 
matt
Guest
Posts: n/a
 
      14th Mar 2006
i've got a macro that refernces other files. rather than hard code the
filepath for the folder the excel file is in, is there a way to determine
the current filepath? it's just that i have different users who have
different shortcuts to the folder and don't want to hard code.

cheers in advance
Matthew


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      14th Mar 2006
The path of an open workbook?

msgbox activeworkbook.path 'the activeworkbook
msgbox thisworkbook.path 'the workbook with the code

msgbox curdir 'the current directory (when you hit File|open)

matt wrote:
>
> i've got a macro that refernces other files. rather than hard code the
> filepath for the folder the excel file is in, is there a way to determine
> the current filepath? it's just that i have different users who have
> different shortcuts to the folder and don't want to hard code.
>
> cheers in advance
> Matthew


--

Dave Peterson
 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      14th Mar 2006
One way:

Dim sPath As String
sPath = ThisWorkbook.Path

In article <4416d2df$(E-Mail Removed)>,
"matt" <matthew hallam> wrote:

> i've got a macro that refernces other files. rather than hard code the
> filepath for the folder the excel file is in, is there a way to determine
> the current filepath? it's just that i have different users who have
> different shortcuts to the folder and don't want to hard code.
>
> cheers in advance
> Matthew

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      14th Mar 2006
does this help?
Sub whatisfilepath()
MsgBox ActiveWorkbook.Path
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"matt" <matthew hallam> wrote in message
news:4416d2df$(E-Mail Removed)...
> i've got a macro that refernces other files. rather than hard code the
> filepath for the folder the excel file is in, is there a way to determine
> the current filepath? it's just that i have different users who have
> different shortcuts to the folder and don't want to hard code.
>
> cheers in advance
> Matthew
>



 
Reply With Quote
 
matt
Guest
Posts: n/a
 
      14th Mar 2006
thanks, is now sorted
Matthew

"matt" <matthew hallam> wrote in message
news:4416d2df$(E-Mail Removed)...
> i've got a macro that refernces other files. rather than hard code the
> filepath for the folder the excel file is in, is there a way to determine
> the current filepath? it's just that i have different users who have
> different shortcuts to the folder and don't want to hard code.
>
> cheers in advance
> Matthew
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
filepath excel 2007 Helen Microsoft Excel Discussion 5 22nd Jul 2009 10:21 PM
"The name 'Filepath' does not exist in the current context" Gwen Microsoft C# .NET 2 2nd Mar 2008 12:10 AM
File.Exists(filePath) always returns false in release mode if filePath contains a white space snow Microsoft VB .NET 12 14th Feb 2007 07:17 AM
How do I show the current Excel filepath in the toolbar line? =?Utf-8?B?UmljazM3ODk=?= Microsoft Excel Misc 3 9th Mar 2006 07:02 PM
current filepath? Lauchlan M Microsoft ASP .NET 1 18th Aug 2003 02:04 AM


Features
 

Advertising
 

Newsgroups
 


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