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

File Name with WildCard 2

Status
Not open for further replies.

Jhtexas

Technical User
Jan 4, 2005
59
US
The file name used in this statement changes revisions from Qc-313a.DOC to Qc-313b.DOC. I want to be able to use a wildcard and not change the code when the file revision changes. Can someone tell me why the "*" does not work as a wild card in the statement below?

Application.PrintOut Background:=0, Copies:=5, FileName:="\\pinnacle\data\Doc-Center\QC Forms\Qc-313*.DOC"

Thanks,
Jim
 
What about this ?
strDir = "\\pinnacle\data\Doc-Center\QC Forms\"
Application.PrintOut Background:=0, Copies:=5, FileName:=strDir & Dir(strDir & "Qc-313*.DOC")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm confused as to the purpose of your code. Do you want to print out Qc-313a.DOC or Qc-313b.DOC?
 
Yes, the code is used to print out documents that have filenames that change only by a revision letter. I want to use a wildcard and not change the code ever time the revision changes.
 
If the old documents are kept in the same folder as the new ones then the wildcard would only find the first file. If that's not an issue then I'd got with Skip's idea of using Dir .I'd also replace the * with a ? because there's only one changing character
 
Sorry, I was just reading another one were Skip had the and got confused. My bad. I'd go with PHV's idea of using Dir
 
PH,
Your example worked great.

If you get a chance, why did the original format fail?

Thanks,
Jim
 
Because the Printout was expecting the path of an existing file and didn't know what to do with the wildcard. Part of dir's function is to work with the wildcard.
 
Thanks again for your help.

Take care,
Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top