+ Reply to Thread
Results 1 to 6 of 6

MasterFile cannot be opened or accessed by several users on the same time

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-20-2011
    Location
    Candada
    MS-Off Ver
    Microsoft Office 365
    Posts
    174

    MasterFile cannot be opened or accessed by several users on the same time

    MasterFile cannot be opened/accessed by several users on the same time. I have a Master Workbook which users from different workstations store data via the use of a VBA macro. In each workstation, users use a workbook called “TimeandAttendance” to track hours worked and attendance. At the end of the shift, each user must click on the button “send it” to send and store collected data. The problem arises when several users are accessing the Master Workbook at the same time. Does anyone know if there is a better way or method of accomplishing this task? These two files are in Excel, but I am thinking if I should use Microsoft Access? The error that we receive when the Master Workbook is opened reads like this: MasterFile.xls is already open. Reopening will cause any changes you made to be discarded. Do you want to reopen MasterFile.xls? Your help is greatly appreciate.
    Attached Files Attached Files
    Last edited by Kimston; 09-16-2012 at 09:33 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: MasterFile cannot be opened or accessed by several users on the same time

    Hi Kimston,

    Where is the "send it" button?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    02-20-2011
    Location
    Candada
    MS-Off Ver
    Microsoft Office 365
    Posts
    174

    Re: MasterFile cannot be opened or accessed by several users on the same time

    Xladept,
    Take a look at the new TimeandAttendance file. I have included the control buttom.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: MasterFile cannot be opened or accessed by several users on the same time

    Hi Kimston,

    Try this:

    Option Explicit
    Dim MFile As String
    Dim lastrow As Long
    Dim frow As Long
    Dim lrow As Long
    Dim i As Integer
    
    Sub update_master()
    'Change the MasterFile Path
    MFile = "C:\Users\Rosendo\Documents\MasterFile.xls"
    
    For i = Workbooks.Count To 1 Step -1
    If Workbooks(i).Name = "MasterFile.xls" Then
    MFile = "MasterFile.xls": GoTo Opened: End If: Next i
     
    Workbooks.Open MFile
    MFile = ActiveWorkbook.Name
     
    Opened:
    
    lastrow = ThisWorkbook.Worksheets("TimeAndAttendance").Range("A" & Rows.Count).End(xlUp).Row
    ThisWorkbook.Worksheets("TimeAndAttendance").Range("A9:H" & lastrow).Copy _
    Workbooks(MFile).Worksheets("Master").Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
    
    frow = Workbooks(MFile).Worksheets("Master").Range("K" & Rows.Count).End(xlUp).Row
    lrow = Workbooks(MFile).Worksheets("Master").Range("B" & Rows.Count).End(xlUp).Row
    
    Workbooks(MFile).Worksheets("Master").Range("J" & frow + 1 & ":J" & lrow).Value = ThisWorkbook.Worksheets("TimeAndAttendance").Range("B3").Value
    Workbooks(MFile).Worksheets("Master").Range("K" & frow + 1 & ":K" & lrow).Value = ThisWorkbook.Worksheets("TimeAndAttendance").Range("B4").Value
    Workbooks(MFile).Worksheets("Master").Range("L" & frow + 1 & ":L" & lrow).Value = ThisWorkbook.Worksheets("TimeAndAttendance").Range("B5").Value
    Workbooks(MFile).Worksheets("Master").Range("A" & frow + 1 & ":A" & lrow).Value = ThisWorkbook.Worksheets("TimeandAttendance").Range("B6").Value
          Workbooks("MasterFile.xls").Close SaveChanges:=True
            'Application.Quit
    End Sub

  5. #5
    Forum Contributor
    Join Date
    02-20-2011
    Location
    Candada
    MS-Off Ver
    Microsoft Office 365
    Posts
    174

    Re: MasterFile cannot be opened or accessed by several users on the same time

    Mr. XLAdept, I used to your code in the TimeandAttendance file and it worked perfectly. I ran this file several time to create enough data in the Master worksheet. Once I had enough data, I went and created a table, so it can automatically refresh the data in the Pivot Table that I also created. However, If I run and click on the TimeandAttendance control bottom, I get incomplete information such as ProductionDate, Supervisors, Department and shift. I believe that once I created the table, this codes stop working. Please take a look at the updated files that I uploaded again. Thank you very much for your time.

  6. #6
    Forum Contributor
    Join Date
    02-20-2011
    Location
    Candada
    MS-Off Ver
    Microsoft Office 365
    Posts
    174

    Re: MasterFile cannot be opened or accessed by several users on the same time

    Does anyone knows how I can accomplish this task?

+ 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