dennismenace


i'm tyring to edit a vb macro in an excel document and i need to have some code that determines what drive and directory the excel file is being run from. i need these values (or value) into variables so that i can check for the existence of other files in the same directory.

i've tried using CurDir without success (unless i was using it incorrectly as it always just returns c:\mydocuments....)

i'm not an experienced vb programmer - so can anyone provide me with some simple code and/or instructions on how to achieve this please.

cheers




Re: vb get drive, directory and file help

John Oliver (UK)MSP, VSIP


dennismenace wrote:

i'm tyring to edit a vb macro in an excel document and i need to have some code that determines what drive and directory the excel file is being run from. i need these values (or value) into variables so that i can check for the existence of other files in the same directory.

i've tried using CurDir without success (unless i was using it incorrectly as it always just returns c:\mydocuments....)

i'm not an experienced vb programmer - so can anyone provide me with some simple code and/or instructions on how to achieve this please.

cheers

Hi,

Please try the VBA forum.

VB code within Excel or any Microsoft Office Application is known as VBA code.

V B A stands for Visual Basic for Applications.

This forum is for VB.Net questions only, sorry.

Click this link.>>

http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=74&SiteID=1

or try this one.>>

http://www.programmersheaven.com/mb/vba/Board.aspx S=B20000

Regards,

John







Re: vb get drive, directory and file help

nullGumby

How about:

Code Block
ActiveWorkbook.Path

Won't that work