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

Word: Using ToLower

Status
Not open for further replies.

nashcom

MIS
Apr 12, 2002
91
GB
I have a Case statement, part of which looks like:

Code:
   Select Case GetPrinterDetails.PortName
      Case "\\scofp1\reslet2c"
         ' HP LaserJet Colour 4650dtn
         Tray1 = 260
         ' etc
   End Select

The GetPrinterDetails.PortName is an element of a structure that is populated by a routine that interrogates the OS about the printer. The Case statement is obviously checking for the port name in lowercase (\\scofp1\reslet2c), whereas, I've just discovered that sometimes the OS will return it in a different case, (eg \\SCOFP1\reslet2c).

I'd like to force the check to lowercase. I assume I need to use the ToLower function, but I'm not sure how to use it. I've been trying things along the lines of:

Code:
   Select Case ToLower(GetPrinterDetails.PortName)
      Case "\\scofp1\reslet2c"
         ' HP LaserJet Colour 4650dtn
         Tray1 = 260
         ' etc
   End Select

I think the 'logic' here would do the trick, but I'm obviously not using the correct command syntax!

David
 
From whatI can make out, it looks like ToLower() is a VB.Net method. Doe the following look better?

Code:
   Select Case StrConv(GetPrinterDetails.PortName, 2)
 

The VBA way is [blue][tt]LCase(GetPrinterDetails.PortName)[/tt][/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top