Results 1 to 9 of 9

Thread: Sharing excel file using vb.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2016
    Posts
    5

    Sharing excel file using vb.net

    Hi.
    I have searched quite a lot but did not find anything useful.
    I created a windows app form in visual studio 2013. Using the form, I can enter data in an excel sheet. Now, the sheet will be shared by multiple users at the same time, i.e., multiple users will be entering data in the sheet at the same time.
    How do I allow this without any conflict?
    Please help.

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: Sharing excel file using vb.net

    I don't believe you can There will be an exclusive lock on it. What are you trying to do that needs to share like that? Maybe a database solution might be a better fit.
    Please remember next time...elections matter!

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2016
    Posts
    5

    Re: Sharing excel file using vb.net

    Quote Originally Posted by TysonLPrice View Post
    I don't believe you can There will be an exclusive lock on it. What are you trying to do that needs to share like that? Maybe a database solution might be a better fit.
    I cannot use any other database because my boss wants it like that. Its just a form that is used to enter details in the excel file and later the employees can open the file and add more details in that row.

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: Sharing excel file using vb.net

    Well I still don't think you can share editing at the same time. Maybe you can check if it is locked first and display a message when it is locked to try again later.

    Pull up a spreadsheet on a shared drive then ask your boss to pull it up and try and edit it. Maybe he\she will see what the issue is.
    Please remember next time...elections matter!

  5. #5
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: Sharing excel file using vb.net

    I agree with Tyson unless there is some setting where you can open it shared. Leaving VB out of it, if I open a spreadsheet in Excel and then someone else tries to open the same one, they can only open it read-only. You should REALLY use Access or some other database for this.

  6. #6
    Hyperactive Member Vexslasher's Avatar
    Join Date
    Feb 2010
    Posts
    429

    Re: Sharing excel file using vb.net

    I don't have a code solution for you but I do have a suggestion that might work for you. With some of my work I use Google Sheets and we just share an account it's worked just the way I needed and also works with tablets too. However I'm not sure what would happen if 2 people edit the same file at the same time haven't run into that yet maybe it updates in real time I'm not sure. You may need to alter files slightly if you upload them they sometimes lose some of the formatting.

  7. #7
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Sharing excel file using vb.net

    I have never attempted this, but take a look at:

    Use a shared workbook to collaborate

    First figure out how to make this work through the Excel interface and take notes. Now you can begin to figure out how to automate that via Excel interop using your VB program.

  8. #8
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: Sharing excel file using vb.net

    Quote Originally Posted by Vexslasher View Post
    With some of my work I use Google Sheets and we just share an account it's worked just the way I needed and also works with tablets too. However I'm not sure what would happen if 2 people edit the same file at the same time haven't run into that yet maybe it updates in real time I'm not sure.
    Indeed it does. I've watched data change pretty quickly as my coworker updated it. Not sure who wins if you try to edit the same cell though.

  9. #9
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: Sharing excel file using vb.net

    Quote Originally Posted by TnTinMN View Post
    I have never attempted this, but take a look at:

    Use a shared workbook to collaborate

    First figure out how to make this work through the Excel interface and take notes. Now you can begin to figure out how to automate that via Excel interop using your VB program.
    From the link:
    A conflict happens when two users are both editing the same shared workbook and try to save changes that affect the same cell. Excel can keep only one of the changes in that cell. When the second user saves the workbook, Excel displays the Resolve Conflicts dialog box to that user.

    In the Resolve Conflicts dialog box, read the information about each change and the conflicting changes made by the other user.

    To keep your change or the other user's change and to advance to the next conflicting change, click Accept Mine or Accept Other.
    To keep all of your remaining changes or all of the other user's changes, click Accept All Mine or Accept All Others.

    To have your changes override all other changes without displaying the Resolve Conflicts dialog box again, do the following:

    On the Review tab, in the Changes group, click Share Workbook.

    On the Advanced tab, under Conflicting changes between users, click The changes being saved win, and then click OK.

    To view how you or others resolved past conflicts, do the following:

    On the Review tab, in the Changes group, click Track Changes, and then click Highlight Changes.

    In the When list, select All.

    Clear the Who and Where check boxes.

    Select the List changes on a new sheet check box, and then click OK.

    On the History worksheet, scroll to the right to view the Action Type and Losing Action columns.
    That's a lot to ask a business community to do from an "automated" system. It seems "real" control is lost and you would just have to hope the user community can keep it all straight.
    Please remember next time...elections matter!

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width