Results 1 to 3 of 3

Opening a workbook already open by another user

Threaded View

  1. #1
    Registered User
    Join Date
    11-22-2010
    Location
    Nottingham, Sheffield
    MS-Off Ver
    Excel 97
    Posts
    4

    Opening a workbook already open by another user

    Hi,

    Firstly thanks for the help I've already had, just have another question if I can be so cheeky.

    The macro below copies data from 10 cells on the open workbook, opens a master workbook called 'test', pastes it into the next free row, saves 'test' , closes it and then clears out the cells from the original workbook so it can be done again. Problem is that as up to 30 people could be using the same 'test' workbook and there is the chance that it could be open already, is there any code that can be added to the current macro that would look to see if the workbook was already open then wait a few moments and try again if it found it so.

    Current macro:

    Sub openclosepastessaves()
    'ThisWorkbook.Save
        Sheets("Gary").Select
        Range("B336:K336").Select
        Selection.Copy
        Workbooks.Open FileName:="C:\********\test.xls"
        'Sheets("Master").Select
        
        Count = 4
        Do
           Count = Count + 1
        Loop Until Sheets("Master").Cells(Count, 2).Formula = ""
        
        Sheets("Master").Cells(Count, 2).Select
        ActiveSheet.Paste
        Workbooks("test.xls").Activate
    ActiveWorkbook.Save
    ActiveWorkbook.Close
        Sheets("Gary").Select
        Range("D336").Select
        Selection.ClearContents
        Range("G336:K336").Select
        Selection.ClearContents
        Range("D336").Select
    End Sub

    Many thanks in advance
    Last edited by KASM; 11-24-2010 at 06:46 AM.

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