[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?
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
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.
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.