+ Reply to Thread
Results 1 to 4 of 4

How to popup msg box ?

  1. #1
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    How to popup msg box ?

    I have 2 files: file1 and file2

    i wanna copy the contain of sheet21 of file2 into sheet11 of file 1
    But , if file2 is not active. How to popup msg box for this case ?

    thank you for help .

  2. #2
    Ron de Bruin
    Guest

    Re: How to popup msg box ?

    Hi vumian

    Not needed that the file or sheet is active when you copy

    You can test if a file is open with this function

    Function bIsBookOpen(ByRef szBookName As String) As Boolean
    ' Rob Bovey
    On Error Resume Next
    bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing)
    End Function


    Use like this

    If bIsBookOpen("test.xls") Then

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "vumian" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have 2 files: file1 and file2
    >
    > i wanna copy the contain of sheet21 of file2 into sheet11 of file 1
    > But , if file2 is not active. How to popup msg box for this case ?
    >
    > thank you for help .
    >
    >
    > --
    > vumian
    > ------------------------------------------------------------------------
    > vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
    > View this thread: http://www.excelforum.com/showthread...hreadid=564102
    >




  3. #3
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Question

    If Workbooks("abc.xls").Activate = True Then
    Call function
    Else
    MsgBox "Error"
    End If

    What's wrong with this code

    thank your for help .

  4. #4
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Thumbs up

    [QUOTE=Ron de Bruin]Hi vumian

    Not needed that the file or sheet is active when you copy

    You can test if a file is open with this function

    Function bIsBookOpen(ByRef szBookName As String) As Boolean
    ' Rob Bovey
    On Error Resume Next
    bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing)
    End Function


    Use like this

    If bIsBookOpen("test.xls") Then

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    Oh, it work great . thank you very much
    a good man.

+ 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