Hi Ranman256
I have used this code that you have previously posted (Not sure how I missed this) opps
on the command button I use this
Code:
Private Sub Command2_Click()
PrintAllFilesInDir "c:\testsheets"
End Sub
and this is the code that prints the PDF's
Code:
Public Sub PrintAllFilesInDir(ByVal pvDir)
Dim vFil As String, vTargT
Dim i As Integer
Dim fso
Dim oFolder, oFile
Dim vOutFile On Error GoTo errImp
If Right(pvDir, 1) <> "\" Then pvDir = pvDir & "\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(pvDir)
For Each oFile In oFolder.Files
vFil = pvDir & oFile.Name
If InStr(vFil, ".pdf") > 0 Then 'ONLY DO PDF FILES
'Print vFil
Call ShellExecute(0, "print", vFil, "", "", 1)
End If
Next
Set fso = Nothing
Set oFile = Nothing
Set oFolder = Nothing
MsgBox "Done"
Exit Sub
errImp:
MsgBox Err.Description, vbCritical, "clsImport:ImportData()" & Err
Exit Sub
Resume
End Sub
This works really well printing all the PDF's from the (c:\testsheets) folder, would you have any idea how I could modify the above to only print the part numbers that match the part number from the combo box called (PartsCBOBox)
Im guessing that I would have to amend the for each section, to reference the combo box but I cant seem to work out how to do this,
Steve