none
MsgBox isn't shown. RRS feed

  • Question

  • Hello 

    In my Visual Basic Code for an Excel AddIn the first MsgBox Line is allways skipped. 

    How can that be?

     Dim pageSetupWs As Excel.Worksheet = CType(CType(getMyWorkBook(), Excel.Workbook).Worksheets(Sheet(inti - 1)), Excel.Worksheet)
    
                If (Copies(inti - 1) > 0 And pageSetupWs.PageSetup.Pages.Count > 5) Then
    
                    MsgBox("ACHTUNG")
                    Dim yesNoResult As MsgBoxResult = MsgBox("The sheet " & pageSetupWs.Name & " wants to print " & pageSetupWs.PageSetup.Pages.Count & " pages. Do you want to continue?", MsgBoxStyle.YesNo)
    
                    If yesNoResult = MsgBoxResult.No Then
                        MsgBox("Please change the printarea in the tab ""Layout""")
                        pageSetupWs.Select()
                        Exit Sub
                    End If
                End If

    So in this Example MsgBox ("ACHTUNG") is ommited.

    Thanks for your help!

    Benedikt


    • Edited by benehsv Tuesday, July 24, 2012 1:42 PM Forgot something
    Tuesday, July 24, 2012 1:41 PM

All replies

  • Hi Benehsv,

    Thank you for posting in the MSDN Forum.

    It will be nice if you could provide your full code or at least a code snippet that can be compiled. In your code, you mentioned getMyWorkBook() which seems to be a function or method defined by yourself thus cannot compile on my machine.

    Thank you for your understanding. I'm looking forward to your reply.

    Best regards,
    Quist


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, July 26, 2012 10:08 AM
    Moderator