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!

Can you retrieve network printer info from printer folder using VBA 1

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Can you read printer information from the My Computer printers folder in VBA. I need to pass a network printer UNC or NT path to another application which generates reports. I would like to do this via a little Access app I would install locally for the users.

Can someone point me or suggest some things to get me started?

Thanks in advance and have a great day!
 
If your just needing to find a path and filename...
just modify the get open filename parameters for the type of file your looking for...
Code:
    Set fs = Application.FileSearch
    With fs
        FileName = Application.GetOpenFilename("Jpeg Files (*.jpg), *.jpg")
        For i = Len(FileName) To 1 Step -1
            If Mid(FileName, i, 1) = "\" Then
                Exit For
            End If
        Next
        .LookIn = Left(FileName, i - 1)
        .FileName = "*.jpg"
        If .Execute(SortBy:=msoSortByFileName, _
        SortOrder:=msoSortOrderAscending) > 0 Then
            MsgBox "There were " & .FoundFiles.Count & _
                " file(s) found."
            i = 1
            For i = 1 To .FoundFiles.Count
  '==> here's where you do something with each filename
              .FoundFiles(i))
            Next i
        Else
            MsgBox "There were no files found."
        End If
    End With
Skip,
Skip@TheOfficeExperts.com
 
Thanks, Skip!

How do I do the above with the printers folder in My Computer so I can send a report to the UNC path for a printer? Or is there a better way to select a printer from a list programatticaly?

Have a great day and thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top