+ Reply to Thread
Results 1 to 11 of 11

Printer status check prior to printing - GetPrinterApi returns 0

  1. #1
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Printer status check prior to printing - GetPrinterApi returns 0

    GetPrinterApi returns 0. Please help.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Hello macarius ,

    Here is an API routine I wrote to return the status of the Active Printer. The return value is a string.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Please Login or Register  to view this content.
    Crashes Excel 2007. Curious. Any experience with this?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Hello macarius ,

    What version of Windows are you running?

  5. #5
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Quote Originally Posted by Leith Ross View Post
    Hello macarius ,

    What version of Windows are you running?

    Win7 x64, Office 2007. Thanks for the expedient replies.

  6. #6
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    http://www.vbforums.com/showthread.php?t=548903

    Could you help adapt the CopyMemory command with suggested fix from this site?

    Most appreciate your expertise in the matter.

  7. #7
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Methinks it must be the 64-bit architecture. Instead of variable type Long, need to use LongPtr. Tried to change without success--keeps crashing. I also tried LONG_PTR which was available--no go. Please, send your thoughts. Need this ASAP--by COB tomorrow. Thanks for all your support.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Hello macarius,

    I made the needed changes to the code to work with 64 bit Windows but it is untested as I don't have a 64 bit platform. Hopefully, it will run without crashing. Let me know what happens.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Firstly, appreciate your efforts.

    My machine is running Win7, but Office 2007 which is only 32-bit AFAIK. The code below is not supported by Office 2007 32-bit on a 64-bit OS. I noticed LONG_PTR was available, but not LongPtr.

    Any ideas?

    Please Login or Register  to view this content.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    Hello macarius ,

    "Long_Ptr" is C Data Type, not VBA. The API has only 2 platforms: 32 and 64 bit. I have posted the code for both. Unless I were there to troubleshoot your system, we are not going to resolve this problem.

  11. #11
    Registered User
    Join Date
    10-15-2010
    Location
    USA
    MS-Off Ver
    Excel 2007/-10
    Posts
    8

    Re: Printer status check prior to printing - GetPrinterApi returns 0

    4 environments: 32-bit office 2007 and 2010, 64-bit 2010 only; then Win7 32- or 64-bit.

    You wrote code for WinOS 32-bit for 2007 or 2010 32-bit; also for WinOS 64-bit for 2010 64-bit; my scenario is WinOS 64-bit, Office 2007 32-bit.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1