+ Reply to Thread
Results 1 to 7 of 7

Closing a file in dropbox opened by another collaborator?

Hybrid View

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Question Closing a file in dropbox opened by another collaborator?

    Hello

    I wonder if we can close a file that is in a shared folder of Dropbox and opened by another collaborator from a different location.For example I am the owner of the file and I want that when I am making changes to a workbook in Dropbox shared folder then all other instances of the same file (that may be opened by other user/collaborator) should be programatically closed. Because I don't want to create a conflicted copy of MY changes.

    Separating the question from above description

    " Can we close a Dropbox file that is opened by another user from another town? (with VBA)"

    Found no solution on the internet. So any help would be greatly appreciated.This is a real pain for me these days.


    Best Regards
    Imran Bhatti
    Teach me Excel VBA

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Closing a file in dropbox opened by another collaborator?

    Hi,

    Unless Dropbox provides an API for that, the answer is almost certainly no.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Closing a file in dropbox opened by another collaborator?

    Quote Originally Posted by xlnitwit View Post
    Unless Dropbox provides an API for that.
    Thanks for the review XlnitWit
    I was thinking there might have been a big gun (API) to invade.Any conventional weapon?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Closing a file in dropbox opened by another collaborator?

    I don't believe so. It would be a little worrying if VBA could easily affect files on remote computers.

  5. #5
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Closing a file in dropbox opened by another collaborator?

    Folder path is

    "C:\Users\Name of my PC\another folder\Dropbox\Uploads\Database14.accdb"

  6. #6
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Closing a file in dropbox opened by another collaborator?

    Thanks Xlnitwit
    If I go one step back and want to know just the status of the file in the shared folder. I mean if that file is opened or not. For that purpose I just found a code on the web
    Dim MyAccess As Object
    
    Sub TestFileOpened()
    
        If IsFileOpen("path to shared folder of Dropbox") Then
            Set MyAccess = GetObject(, "Access.Application")
        MsgBox ("Already in use.")
            MyAccess.Quit
        Else
            Set MyAccess = CreateObject("Access.Application")
        MsgBox "File not in use!"
            MyAccess.Visible = True
            MyAccess.OpenCurrentDatabase ("path to shared folder of Dropbox")
        End If
        
    End Sub
    Function IsFileOpen(filename As String)
        Dim filenum As Integer, errnum As Integer
    
        On Error Resume Next   ' Turn error checking off.
        filenum = FreeFile()   ' Get a free file number.
        ' Attempt to open the file and lock it.
        Open filename For Input Lock Read As #filenum
        Close filenum          ' Close the file.
        errnum = Err           ' Save the error number that occurred.
        On Error GoTo 0        ' Turn error checking back on.
    
        ' Check to see which error occurred.
        Select Case errnum
    
            ' No error occurred.
            ' File is NOT already open by another user.
            Case 0
             IsFileOpen = False
    
            ' Error number for "Permission Denied."
            ' File is already opened by another user.
            Case 70
                IsFileOpen = True
    
            ' Another error occurred.
            Case Else
                Error errnum
        End Select
    
    End Function
    This works fine for my PC. But if I use this from another PC it says file not found.Would you please review it when you have some time as it would be a complicated one.
    Last edited by ImranBhatti; 06-01-2017 at 06:31 AM.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Closing a file in dropbox opened by another collaborator?

    I do not believe that this approach would work for two reasons. First, it is not the correct approach for an access database, which creates a lock file (.ldb) when opened. Second, the other user has their own local copy of the file open and that copy is then synchronised by Dropbox later. You do not both have the same file open at any point.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vba to only allow file to be opened from folder in dropbox, not on local cpu
    By thecdnmole in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2016, 08:40 AM
  2. [SOLVED] Closing a workbook you opened
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2015, 11:48 AM
  3. Excel VBA Code to upload a file to Dropbox using the Dropbox API
    By gb# in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2014, 03:41 PM
  4. Splash screen in file opened by VBA hinders further processing of opened file.
    By Rod38 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2012, 09:53 AM
  5. Closing a File opened via GetOpenFilename
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2009, 11:53 AM
  6. Trouble closing a workbook opened by another
    By GCF in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2005, 12:08 AM
  7. [SOLVED] closing opened workbook/app in memory
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2005, 05:06 PM

Tags for this Thread

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