[RESOLVED] Print question
In line with my last question...
I have this code that looks at my inventory. If the item is active, it looks for a PDF file that starts with that product number. That works. However, if it finds the PDF, I need to be able to print it.
My code that works :
Code:
Dim msg As String
msg = ""
Dim foundit As String
Dim name As String
'==============================
Set rs1 = New ADODB.Recordset
'==============================
sql = "SELECT * FROM PRINTED WHERE LTRIM(RTRIM([CUST])) = " & "'" & "TRIA" & "'"
sql = sql & " ORDER BY [PRTD]"
rs1.Open sql, CnxnTechSQL, adOpenKeyset, adLockReadOnly, adCmdText
If Not rs1.BOF And Not rs1.EOF Then
rs1.MoveFirst
Do
If rs1![actinact] = "A" Then
name = "Z:\Junior\PDF\" & rs1![prtd] & "*.PDF"
foundit = Dir(name)
If foundit <> "" Then
MsgBox name
Else
msg = msg & rs1![prtd] & vbCrLf
End If
End If
rs1.MoveNext
Loop While Not rs1.EOF
End If
rs1.Close
Set rs1 = Nothing
'=================
MsgBox "DONE" & vbCrLf & msg
There is some extra code for testing purposes right now.
When this is executed
I get something like "Z:\Junior\PDF\1234567*.PDF"
What I want to see is the file's name, such as
"Z:\Junior\PDF\1234567 Brand new hair Conditioner 25 oz.PDF"
Maybe I don't need that. What I need to do, instead of the msgbox is to print the PDF file. Without the filename, how can I do that?
Re: [RESOLVED] Print question
file name strings passed to the shell as an argument can not have any spaces in them unless the entire file name string is enclosed in quotes
one reason why shell execute is a better option
to enclose string in quotes
fname = """" & fname & """"
where fname is a file name /path