+ Reply to Thread
Results 1 to 2 of 2

MsgBox not displaying right away

  1. #1
    Ray Kanner
    Guest

    MsgBox not displaying right away

    I have the following code in my program.

    myPDF.FileToPDF PSfilename, PDFfilename, ""
    If Not FileExists(PDFfilename) Then _
    MsgBox PDFfilename & " not created"

    It is creating a PDF file from a PS (PostScript) file.
    Everything is working fine with one exception.
    If "PDFfilename" does not exist, and the code should
    print out the message "PDFfilename not created", etc.,
    the screen (kind of - the top blue part of the Excel
    window) blinks, i.e. the message does not pop right up
    (it's as if another program has the focus). I need to
    click the mouse within Excel and then the message pops
    up. What is happening and how do I get around this
    problem?

    Thanks

    Ray - [email protected]

  2. #2
    Jim Cone
    Guest

    Re: MsgBox not displaying right away

    Ray,

    You can use an API call...
    Put this at the top of your module, above all subs and functions:

    Public Declare Function MessageBox Lib "user32" _
    Alias "MessageBoxA" (ByVal hwnd As Long, _
    ByVal lpText As String, _
    ByVal lpCaption As String, _
    ByVal wType As Long) As Long
    '---------------------------------------------

    Then call the message box something like this:

    Sub DisplayMsgBoxOnTop()
    Dim MsgResponse As Long
    MsgResponse = MessageBox(hwnd:=0, lpText:="This is a Test", _
    lpCaption:=" Test Message", _
    wType:=vbOKCancel + vbExclamation)
    End Sub
    '---------------------------------------------------------------

    Regards,
    Jim Cone
    San Francisco, USA



    "Ray Kanner" <[email protected]> wrote in message
    news:[email protected]...
    > I have the following code in my program.
    >
    > myPDF.FileToPDF PSfilename, PDFfilename, ""
    > If Not FileExists(PDFfilename) Then _
    > MsgBox PDFfilename & " not created"
    >
    > It is creating a PDF file from a PS (PostScript) file.
    > Everything is working fine with one exception.
    > If "PDFfilename" does not exist, and the code should
    > print out the message "PDFfilename not created", etc.,
    > the screen (kind of - the top blue part of the Excel
    > window) blinks, i.e. the message does not pop right up
    > (it's as if another program has the focus). I need to
    > click the mouse within Excel and then the message pops
    > up. What is happening and how do I get around this
    > problem?
    >
    > Thanks
    >
    > Ray - [email protected]


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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