PDA

View Full Version : Filepath Variable



tmptplayer
01-05-2008, 03:24 PM
Hey All,
I'm a little rusty with my VBA. I want to reference a file that will always be in the same directory as the excel book holding the VBA. Is there a variable I can use that will give me my workbook's location... Thanks!

-Brian

malik641
01-05-2008, 03:51 PM
Yes,

ThisWorkbook.Path

tmptplayer
01-05-2008, 04:02 PM
Worked perfectly. You wouldn't know of a similar feature for power point would you?

tmptplayer
01-05-2008, 04:05 PM
Nevermind- it is ActivePresentation.Path

Thanks!

malik641
01-05-2008, 04:16 PM
Something interesting to note:

In the ThisWorkbook class module:
Msgbox Me.Path

In any Sheet class module:
Msgbox Me.Parent.Path