Results 1 to 4 of 4

Thread: [RESOLVED] Run-time error '2147467259(80004005)'

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    816

    Resolved [RESOLVED] Run-time error '2147467259(80004005)'

    I've just gotten a problem when printing.

    I get an error:

    Run-time error '2147467259(80004005)'
    Automation error
    Unspecified error

    on the line:

    If Not printDlg.ShowPrinter(Me.hWnd) Then

    I think it's because I added some code to make the MDI allow only OneInstance of the program.

    I don't know what Me.hwnd means so I really don't know how to fix it. Can anyone help me?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Run-time error '2147467259(80004005)'

    What is printDlg? Is it a common dialog control? If so, your command is incorrect and mabye should be like the following. The .ShowPrinter method does not have parameters.
    Code:
    ....
    printDlg.CancelError = True  ' if user cancels, then a trappable error occurs
    On Error Resume Next
    printDlg.ShowPrinter
    If Err Then 
        ' user hit cancel or something else happened
        ... do what you want, if anything
        Err.Clear
    Else
        On Error GoTo 0  ' stop ResumeNext error trapping
         ... succcess, do what is needed here
    End If
    Last edited by LaVolpe; May 31st, 2009 at 11:35 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    816

    Re: Run-time error '2147467259(80004005)'

    Lavolpe,

    I can't remember why I needed to use it but the print dialog is not the default one.
    I tried your code but it seems the this dialog does require a parameter on .showPrinter.

    http://support.microsoft.com/kb/322710

    I've just cut and pasted the code from their site and it now seems to get past the line I had the problem with. I don't know what the problem was at the moment but thanks for pushing me in the right direction to solve it.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Run-time error '2147467259(80004005)'

    You're welcome. What you are using is not the common dialog, rather it is some other DLL. That explains why the parameter is required; the DLL's class function/method requires the parameter.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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