Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening files on network drives within a macro.

Status
Not open for further replies.

mattst

Technical User
Jun 9, 2005
2
US
I'm trying to open specific files from network drives, but I can't use specific addresses for the files... I'll explain, but here is the code I'm using:



if checkfile("Counterparty Report.xls") then
else
workbooks.open filename:="Counterparty Report.xls"
end if



This works when the the file I'm trying to open and the file that this is being run in are in the same folder on my computer. But when I try to do the same thing on a mapped network drive, this will not work. I do not want to put in specific address for the files because the files will be moved around, but remain in the same folder. So I need this to be able to work as long as they are in the same folder.

Am I doing something wrong, is there a better way to do this, or is this even possible?

Thanks.
 
Have a look at the ActiveWorkbook.Path property.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
ou will need to use the fully qualified path and name.

"\\networkdrivename\partitionname\dir\dir\filename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top