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!

Open multiple files 2

Status
Not open for further replies.

PALman

Technical User
May 15, 2002
160
GB
The following code finds and opens a document Ok.
However I need to add code to make it loop and search/open others when there is more than one document in the folder.
At the moment the code just opens the first it finds.
Each file in the folder has a common job number as the first part of its filename and the second part of filename would differ.
Also would it be possible to make a list of the documents found as well as opening them.

Path04_ConsAccept = "C:\Quality\ConsAcceptances\"
filename = Dir(Path04_ConsAccept + Me.JobNo & "*")
strFile = Path04_ConsAccept + filename
FollowHyperlink strFile

Any help much appreciated.
 
Path = DLookup("Path", "[!][[/!]Folder Paths[!]][/!]", "PathNo='Path04'")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry PHV,
Correction to line with added brackets [] still gives same error "Bad File or Number"
THIS LINE REMMED OUT BUT IS OK 'Path = DLookup("[Path]", "Folder Paths", "[PathNo] ='Path04'")
NEW LINE IS OK TOO... Path = DLookup("Path", "[Folder Paths]", "PathNo='Path04'")
MsgBox Path (THIS GIVES CORRECT PATH FROM EITHER OF THE TWO LINES ABOVE)
strFile = Dir(Path & Me!JobNo & "-*.*") (PROGRAM STOPS WITH ERROR IS IN THIS LINE)
 
Hi PHV
I found what was causing above error. I had stored the path in the Folder Paths table within "" . Removing these inverted commas "" sorted the problem.
I have couple of other queries you may be able to help me with. Please see new thread/s which I am about to post soon.
Thanks again,
PALman.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top