+ Reply to Thread
Results 1 to 2 of 2

confirm file open

  1. #1
    Registered User
    Join Date
    01-22-2005
    Posts
    1

    confirm file open

    Currently I have an application that evaluates 3 separate ranges concurrently, if a value is found in a range then I open a second workbook and copy the values then close and save the second workbook. So if a value is found in all 3 ranges I will open and close the second workbook 3 times.

    I already have code that determines if I should open the second workbook but if I try and open the workbook when it is already open I get a message that warns me that opening the workbook again will discard any change I have made.

    What I want is just some code that I can use to check if the workbook is already open then skip over the open file.
    Sub open_time_off()
    ' need to check if workbook time_off is open
    Workbooks.Open Filename:="c:\temp\time_off.xls" 'open time off file
    Workbooks(1).Activate ' activates current time sheet
    End Sub

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Use this sub:

    Please Login or Register  to view this content.
    What this sub tries to do is:
    for each cell in the range, it tries to enter the value in the other file. If the file is not open, it gives an error, and then goes and opens the file, and then enter the value.

    - Mangesh

+ 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