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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba Connection issue for query table

Status
Not open for further replies.

reimbursement

Programmer
May 5, 2003
7
US
I need to be able to be able to change the file location of a .prn file to represent where the user may have it mapped on their computer.

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;I:\PROJECTS\waytd.prn", Destination:=Range("A1"))
Using the thisworkbook.path does not work nor does defining the file address.

For example my drive is mapped as I: whereas my co-worker's drive is mapped as F:. Hard coding will not work.

Any Suggestions?
 
reimbursement,

You can use Application.GetOpenFilename to have the user locate the .prn file.

Then use THAT path in your connect string.

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top