• WSharrella

    WSharrella

    @wsharrella

    Viewing 12 replies - 1 through 12 (of 12 total)
    Author
    Replies
    • in reply to: Authentication inside of VBScript? (VB/VBScript) #621606

      Hey, I understand. When I posed this to my boss, he also had BIG security concerns. What I was thinking of was that since I have certain Admin rights, whenever I send an e-mail triggering a script to run, I wanted it to have MY rights to run, and not the default rights of the service that read the e-mail …. Long story, won’t bore you w/details, but suffice to say that I have to go another route and see about how to authenticate e-mail senders ……

      Thanks for the reply anyway!

      Andrew

    • in reply to: Is file Open? (vb6) #621464

      I’m new to alot of this, but couldn’t you just create a temp file once the program is running and then delete the temp file before exiting the pgm. Have code to check to see if temp file exists — If so, exit pgm …

      Make sense?

      Andrew Harrell
      very newbie VB programmer

    • first, thanks to all who took time to look at this for me …

      Rory, I’ll give your syntax a try, but I suspect that will not do anything. I’m thinking that the script dies on the getobject line. As a test, I put a msgbox right after the getobject line (no conditional code). It never displayed the msgbox, it just halted execution of the script. Arrgh!!! I wonder if there is a way to test before doing the getobject — some kind of object.exists ….

      I’ll keep working at it and if I come up with anything I will post it … thanks

    • nothing — the MsgBox does not come up at all.

      Could this be something to do with the fact I’m dealing with an object , and therefore I might have to do some kind of test with vbObjectError and do an Err.Raise? I’m starting to wonder if the getobject call is doing something on the server side (calling to Active Directory), and the server is passing back an error that kills the script on the getobject call. Does that make any sense?

      I’m just kinda groping here …. thanks

    • Gave the ” If objUser Is Nothing then …” a test, but no dice — same as before.

      Anything else to try? Again, thanks for whatever help!!

    • Wow. Now the fun begins ……. compute

      This may take me some time to work through, but thanks for the headstart. I’ll report back if there is success or if I have to give up ….. surrender

      Thanks again! Andrew

    • in reply to: VB/VBA code to change HP Printer settings? (Word 2000) #589259

      Thanks Rory — but if it gets too hairy/scary, don’t worry — remember you’re talking to a newbie that has to get this all to work!!! If it get’s too complex, it may get beyond my ability to implement!!

    • in reply to: VB/VBA code to change HP Printer settings? (Word 2000) #589245

      Thanks for the leads on the escape codes. The more I think about it, the more I’m not sure the codes will work. The problem lies in the fact that despite my telling the printer how I want to print my document (e.g. macro code says print from tray 1 with letter-size paper) if the printer thinks it has legal-sized paper in tray 1, then it will skip printing from tray 1 and use another tray.

      Maybe what I’m looking for is a PCL-type command to send to the printer via my macro to change the paper-type designation of tray 1. I’m going to spend some more time at the HP site looking into the PCL issue …

      thanks, Andrew

    • I know there were some problems with the HP4050 … interestingly, I heard of a fix that involves getting the firmware on the HP printer updated. It addresses just what you were saying was happening. Supposed to be free if printer is still under warranty.

      Does anyone remember the “olden days” when you used to have to send escape codes to HP printers to get them to format correctly? I’m wondering if there is a way through a macro to send the escape codes and tell the printer that “paper type=draft and size=letter” so that the printer would reset itself ….

      A thought …. anyone else have an idea?

      thanks again …. Andrew

    • in reply to: VB/VBA Call to determine printer type? (Word 2000) #537405

      OK, I’ve got the code … many thanks for what would have been the hard part for me to figure out — the registry lookup , etc …

      A little info on the completed macro — I am not an HP printer expert. A big part of getting this macro to work was to check every printer(actually the driver) and then see what settings are made when different printers are used as the default printer.

      Well …. Enjoy, and let me know what you think about my first effort here …….

      ‘*** Document Paper Type Macro ****************************

      ‘Written by: Andrew Harrell on: 8/06/01

      ‘**********************************************************

      Option Explicit ‘turn on required var declaration
      ‘Give the paper types a name; easier to follow code
      Private Enum gtPaperType
      draft = 1
      Letterhead = 2
      Other = 3
      End Enum

      ‘These next three subs form the macs for the toolbar
      Public Sub SelDraftPaper()
      Call DiscoverPrinter(draft)
      End Sub
      Public Sub SelLHPaper()
      Call DiscoverPrinter(Letterhead)
      End Sub
      Public Sub SelOtherPaper()
      Call DiscoverPrinter(Other)
      End Sub

      ‘ **********************************************************
      ‘ Discover Default Printer (by printer driver)
      ‘ **********************************************************
      Private Sub DiscoverPrinter(ByVal intChoice As gtPaperType)
      Dim strPrinter As String, strdriver As String, strServer() As String

      ‘ *** Retrieve full printer name and port string
      strPrinter = Application.ActivePrinter
      ‘ *** Strip port information
      strPrinter = Left(strPrinter, InStr(1, strPrinter, ” on “, vbBinaryCompare) – 1)
      ‘ *** Parse server name from share name
      strServer = Split(strPrinter, “”, , vbTextCompare)
      ‘ *** Look up driver name in Registry
      strdriver = System.PrivateProfileString(“”, “HKEY_LOCAL_MACHINESoftware” & _
      “MicrosoftWindows NTCurrentVersionPrintProvidersLanMan Print Services” & _
      “Servers” & strServer(2) & “Printers” & strServer(3), “Printer Driver”)

      ‘ *** Now call the proper Printer subroutine to set the bins
      Select Case strdriver
      Case Is = “HP LaserJet 5”
      Call HP5BINZ(intChoice)
      Case Is = “HP LaserJet 5N”
      Call HP5BINZ(intChoice)
      Case Is = “HP LaserJet 4 Plus”
      Call HP5BINZ(intChoice)
      Case Is = “HP LaserJet 4000 Series PCL”
      Call HP4000BINZ(intChoice)
      Case Is = “HP LaserJet 4050 Series PCL”
      Call HP4000BINZ(intChoice)
      Case Else
      MsgBox Prompt:=”You must manually set Paper trays” & vbLf & “for this Printer: ” & strdriver, _
      Buttons:=vbOKOnly + vbInformation, Title:=”Set Paper Trays”
      End Select

      End Sub
      ‘ **********************************************************
      ‘ End of Macro
      ‘ **********************************************************

      Private Sub HP5BINZ(ByVal intChoice As gtPaperType)

      ‘ HP5BINZ Macro
      ‘ Macro recorded 8/01/2001 by Harrella

      With ActiveDocument.PageSetup

      Select Case intChoice
      Case Is = gtPaperType.draft
      .FirstPageTray = wdPrinterDefaultBin
      .OtherPagesTray = wdPrinterDefaultBin
      Case Is = gtPaperType.Letterhead
      .FirstPageTray = wdPrinterLowerBin
      .OtherPagesTray = wdPrinterUpperBin
      Case Is = gtPaperType.Other
      .FirstPageTray = wdPrinterManualFeed
      .OtherPagesTray = wdPrinterManualFeed
      End Select

      End With
      End Sub

      Private Sub HP4000BINZ(ByVal intChoice As gtPaperType)

      ‘ HP4000BINZ Macro
      ‘ Macro recorded 8/01/2001 by Harrella

      With ActiveDocument.PageSetup

      Select Case intChoice
      Case Is = gtPaperType.draft
      .FirstPageTray = wdPrinterDefaultBin
      .OtherPagesTray = wdPrinterDefaultBin
      Case Is = gtPaperType.Letterhead
      .FirstPageTray = 260
      .OtherPagesTray = 261
      Case Is = gtPaperType.Other
      .FirstPageTray = 257
      .OtherPagesTray = 257
      End Select

      End With
      End Sub

    • in reply to: VB/VBA Call to determine printer type? (Word 2000) #535384

      Hey, thanks for the effort and the code! It did work — I found the same registry data earlier in the evening, and fumbled thru getting the strDriver parsed to get to the share name (not as elegant as you did it). And it did work!!

      Next step is to put in the conditionals for the printer driver types … will post the code as soon as Karen and I have tested …. thanks again!

    • in reply to: VB/VBA Call to determine printer type? (Word 2000) #535190

      Will be happy to do so … will need to get with some of my more-experienced colleagues to apply … but will post back.

      Many Thanks!!

    Viewing 12 replies - 1 through 12 (of 12 total)