Consulting

Results 1 to 2 of 2

Thread: Not Working : Opening an Excel workbook from SharePoint in edit mode from a user form

  1. #1
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location

    Not Working : Opening an Excel workbook from SharePoint in edit mode from a user form

    Hi Experts,

    I am trying to open an Excel workbook in edit mode from my company's SharePoint site through a user form in Excel. This user form will be used by multiple users (as an excel add-in) for recording their daily activities. So basically I want to allow multiple users to open the excel workbook at same time and add entries using this user form. Following are the issues that I'm facing.

    1. If a user opening it for the first time then it opens in read only mode.
    2. And later on, only for the first user it is opened in edit mode for rest all the users it is in read only mode.

    I tried the following by searching this issue on the internet, but nothing could resolve the issue-
    I tried adding ActiveWorkbook.LockServerFile to the created object (returns an error)
    The error I get is Run-time Error '1004' Method 'LockServerFile' of object' _Workbook' failed
    I also tried opening it using : Workbooks.Open(ReadOnly:=False), also did not help

    Sub UserForm_Initialize()
    DBFile = "https://companydomain-my.sharepoint.com/personal/central_bkp_companydomain_com/Documents/Central%20BKP/Time%20Sheets/Time%20Sheet%20Database.xlsx"
    Set DestnWB = Application.Workbooks.Open(Filename:=DBFile, Password:="XXXX", ReadOnly:=False)
    'DestnWB.LockServerFile
    Following is the message that the user gets on clicking Submit button which adds all the entries to the workbook and save the workbook
    MicrosoftTeams-image.jpg

    Error on clicking "No"
    MicrosoftTeams-image (1).jpg

    Thanks in Advance
    Last edited by anish.ms; 04-24-2021 at 09:36 PM.

  2. #2
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location
    I think encryption of the file was the problem, which also disables the autosave option.
    It seems to be working after removing the encryption.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •