Results 1 to 6 of 6

Thread: PrintDlg API in VBA...... URGENT!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    24

    Angry

    Hi,
    I am using MS Access97. I can use the printdlg api to open up the Print dialog but i am unable to retrieve what printer the user selected & then get my report to print to that printer (probably using prtDevNames & prtDevMode properties). Here is the code i have that opens the print dialog but i am kinda a lost on what to do after the dialog has been open....any suggestions would be greatly appreciated....
    Also how can i set the prtdevnames & prtdevmode properties back to the original way
    CODE
    ----

    Dim lngretVal As Long
    Dim udtPrDlg As PrintDlg

    With udtPrDlg
    .lStructSize = Len(udtPrDlg)
    .hwndOwner = frm.Hwnd

    'set other struct members here
    End With


    lngretVal = PrintDlg(udtPrDlg)

    DoCmd.OpenReport "tickets", acViewNormal, "ticketqry"

    ' The above line sends the report to the printer, but the default printer & not the one selected by the user.


  2. #2

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    24
    OK, I guess this has become too complicated....

    Would anyone Instead know how to simply open the printers folder from Code...

  3. #3
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    I'm not sure if this is what you need, but take a look.

    Update: Sorry that is for Windows CE

    But take a look at this one.
    Hope this helps.

    [Edited by dsy5 on 10-06-2000 at 07:47 PM]
    Donald Sy - VB (ab)user

  4. #4
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    Ok, I think I've found your solution! Try this code:
    Code:
    Shell ("rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder")
    Donald Sy - VB (ab)user

  5. #5
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    You also may be able to use this code for ideas on how to change the default printer using the registry.
    You could maybe write to the registry with API to change it.
    Donald Sy - VB (ab)user

  6. #6
    http://www.vbapi.com/ref/p/printdlg.html should get you up and running with the PrintDlg API call. As I found out the hard way, the printer and print spooler API calls are nothing you want to tackle within VB on your own. Defining, receiving, unpacking, and repacking the data structures used in these calls is decidedly non-obvious and non-trivial.

    John Fritch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width