Excel file already used by another user.


There may be a lot excel files stored in network and some users have equal rights to access the excel files. In a scenario when a user opens an excel file, the same file can be opened by another user. He gets a popup message “This file is already used by another user”.  It is difficult for that user to identify who has opened that particular file.

Solution:

You need to write a VBA code to solve the above issue. This will help to identify the user who is currently working with that file. Please find the procedure below.

My working environment – office 2010.

  1. Open a excel file and press ALT + F11
  2. This will open VB editor
  3. Go to insert menu and select modules
  4. Type the required VBA code in that text area

“Private Sub Workbook_SheetActivate(ByVal Sh As Object)

If ActiveSheet.Name = “Sheet1” Or ActiveSheet.Name = “Sheet2” Then

Cells(1, 1) = Environ(“username”)

End If

End Sub”

5. Save the worksheet.

 

This solves the problem.

Ref url: http://www.ozgrid.com/forum/showthread.php?t=20091

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: