Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

2 questions about dialog boxes

Posted on 2004-08-17
1
Medium Priority
?
664 Views
Last Modified: 2008-01-09
I have this dialog box saying "There was an error opening this document/ the file is damaged and could not be repaired" it has an Adobe Acrobat title bar. This is the code in which the error appeared:
Sub pdfprocess()
    On Error GoTo pdferrorhandler
    Dim x
    x = PrintFile(fileloc)
    PrintDetector
pdferrorhandler:
End Sub

Private Function PrintFile(strFileName As String) As Boolean
    Const SW_HIDE = 0
    Const SW_MAXIMIZE = 3
    Const SW_MINIMIZE = 6
    Const SW_RESTORE = 9
    Const SW_SHOW = 5
    Const SW_SHOWDEFAULT = 10
    Const SW_SHOWMAXIMIZED = 3
    Const SW_SHOWMINIMIZED = 2
    Const SW_SHOWMINNOACTIVE = 7
    Const SW_SHOWNA = 8
    Const SW_SHOWNOACTIVATE = 4
    Const SW_SHOWNORMAL = 1
    Const ERROR_OOM = 0
    Const ERROR_FILE_NOT_FOUND = 2
    Const ERROR_PATH_NOT_FOUND = 3
    Const ERROR_BAD_FORMAT = 11
    Const SE_ERR_ACCESSDENIED = 5
    Const SE_ERR_ASSOCINCOMPLETE = 27
    Const SE_ERR_DDEBUSY = 30
    Const SE_ERR_DDEFAIL = 29
    Const SE_ERR_DDETIMEOUT = 28
    Const SE_ERR_DLLNOTFOUND = 32
    Const SE_ERR_FNF = 2
    Const SE_ERR_NOASSOC = 31
    Const SE_ERR_OOM = 8
    Const SE_ERR_PNF = 3
    Const SE_ERR_SHARE = 26
    On Error GoTo PrintFileError
    ShellExecute Me.hwnd, "print", strFileName, vbNull, vbNull, SW_SHOWMINIMIZED
    DoEvents
    PrintFile = True
    Exit Function
PrintFileError:
    PrintFile = False
    'MsgBox "Error #" & Err.Number & vbCrLf & Err.Description, vbCritical, "Error Printing File"
    Exit Function
End Function

I also have this dialog box saying "print titles must be contiguous and complete rows or columns" it has a Visual Basic title bar. This is the code in which the error appeared:
Sub excelprocess()
    Dim i As Integer
    On Error GoTo xlserrorhandler
    Set excel_app = New Excel.Application
    Set excel_wb = excel_app.Workbooks.Open(fileloc, 0)
    DoEvents
    For i = 1 To excel_wb.Worksheets.Count
        Set excel_ws = excel_wb.Worksheets(i)
        excel_ws.Visible = True
        excel_ws.Columns.Hidden = False
        excel_ws.Rows.Hidden = False
        excel_ws.PrintOut
        DoEvents
    Next i
    PrintDetector
    Set excel_ws = Nothing
    excel_wb.Close False
    Set excel_wb = Nothing
    excel_app.Quit
    Set excel_app = Nothing
    Exit Sub
xlserrorhandler:
    errorflag = 1
    Set excel_ws = Nothing
    excel_wb.Close False
    Set excel_wb = Nothing
    excel_app.Quit
    Set excel_app = Nothing
    Exit Sub
End Sub

The question is how to disable these dialog boxes through the code?
0
Comment
Question by:4ceReconSniper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
brianb99999 earned 1500 total points
ID: 11826355
1.
The bug dialog is being shown and controlled from the program you are calling - I think it would be very hard to disable this (maybe using Spy++ to get the handle of the message and then intercepting it somehow).

2.
You need to debug to see exactly what line the error is occuring on.  If it is a problem in excel then see 1 above, otherwise try adding into
xlserrorhandler:
err.clear
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question