Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Word 2010 ActivePrinter property case sensitive

Posted on 2011-02-11
1
Medium Priority
?
3,047 Views
Last Modified: 2012-05-11
Hi,

We use VBA macro's in Word to change the printer before printing a document.

     Application.ActivePrinter = "\\server\printer"

This code has worked since WordXP however in Word 2010 the server part became case sensitive. Therefore the following will work ...
     Application.ActivePrinter = "\\server\printer"
but this will not work
     Application.ActivePrinter = "\\Server\printer"
resulting in Error 5216

To make things worse on the same Windows 2003 network, the case changes from pc to pc so the code will work on one computer but the case needs te be different on another.



0
Comment
Question by:dataconsult01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 34878156
You could look for the printer name with the expected capitalisation with this function.
Function GetPrinter(strMyCasePrinter As String) As String
    Dim WshNetwork As Object
    Dim Printers As Object
    Dim printer As Variant
    Set WshNetwork = CreateObject("WScript.Network")
    Set Printers = WshNetwork.EnumPrinterConnections
    For Each printer In Printers
        If UCase$(strMyCasePrinter) = UCase$(printer) Then
            GetPrinter = printer
            Exit For
        End If
    Next
End Function

Open in new window

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question