|
-
May 5th, 2003, 04:25 PM
#1
Thread Starter
Member
*RESOLVED * String Comparison Problem
I have stored the names of two printers in an INI using WritePrivateProfileString. I read them back into two strings using GetPrivateProfileString. I then want to set the printer to the name of one of those strings:
Dim prn As Printer
Dim str As String
For Each prn In Printers
str = prn.DeviceName
If Name$ = str$ Then MsgBox "Success": Exit For
MsgBox Name$
MsgBox str$
Next
The problem is that both Name$ and String$ are exactly the same in the MsgBoxes but my success condition never fires. Do i need to do some special formating to get a loaded INI string to match a Printer DeviceName string?
Solution:
Ret$ = Space(255)
Call GetPrivateProfileString("Printers", "FullPage", "", Ret$, 255, IniFile$)
Ret$ = Left(Ret$, Len(Trim$(Ret)) - 1)
fpPrinter$ = Ret$
Last edited by Eikon; May 5th, 2003 at 06:14 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|