there is a problem with
VB Code:
  1. p1 = Printer.DeviceName
  2. p2 = Printer.DeviceName & "," & Printer.DriverName & "," & Printer.Port
  3. For Each p3 In Printers
  4.     If Left(p3.DeviceName, 11) = "ElectraSoft" Then Exit For       'p.DeviceName
  5. Next
  6. SetDefaultPrinter p3.DeviceName       'for windows 9x
  7. p4 = p3.DeviceName & "," & p3.DriverName & "," & p3.Port
  8.  
  9.     r = WriteProfileString("windows", "Device", p4)    'for XP/NT
beacuse if you exit the loop p3 looses is data