-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug #30
Comments
Thanks @dcircleinc for raising this and the other issues. I will try to check this tomorrow on my Mac. |
A note that may help, I signed out of OneDrive within Excel. No change.
I used the mac tool to reset credentials (tool can be found in the Resources folder of the onedrive app’s contents). No change.
I used the reset onedrive tool within the app’s contents, and it didn’t work. I did this again, and the second time, when I opened a file (opening the file from onedrive.com <http://onedrive.com/> “in app” or “Open in Excel”), this time it prompted to access to folders (Grant permissions warnings). After that, it worked.
It asked for Grant permissions to some cloud folders and then the actual onedrive folders where the PDF file being generated is to be saved.
It may be related to Onedrive on Mac (or Onedrive account linked withing excel) somehow changing or losing permissions to those folders, and then the script not being able to access the folders to iterate and save.
I tried loading a local version of the excel file directy, and it initially did the same thing. I confirmed that the the save-to folder requested with the script does exist locally on the user’s Mac. Just in case it requres that instead of just the "Cloud Folder" that OneDrive may create if the file folder to save the PDF to isn’t set to be synced locally using the OneDrive App.
… On Sep 23, 2024, at 1:14 PM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc> for raising this and the other issues. I will try to check this tomorrow on my Mac.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF4SW65HO2TT4JFYQ23ZYBD53AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRYHA4DQOJXGM>.
You are receiving this because you were mentioned.
|
Thanks @dcircleinc for the detailed info! I updated to the latest OneDrive version for Mac (the preview one) and I cannot recreate the issue. Can you please test Guido's version of GetLocalPath and see if that has the same issue on the other Mac? |
I was unable to reproduce the issue once I ran the reset onedrive tool the second time on that single Mac. I have the latest non-preview version, which was already installed when the error began. I think it has something to do with permissions as after resetting onedrive the second time, the excel file asked to Grant Permissions multiple times to different folders (though I only requested access to one folder), and then it didn’t produce the error. The error just started happening suddenly, nothing changed in the code and OneDrive was already on the same version. The only thing that did change was in onedrive online (web), one of the shared folders was moved to a new location, but the the error occurred on the other workbooks were opened in folders that hadn’t been changed. Maybe there’s a way to force excel to require asking for permissions again. I think this can be done in VB by requesting a folder listing “behind the scenes” using a DIR function, not sure.
Should I update to the new version you pushed anyway?
Ryan Taliercio
***@***.***
… On Sep 25, 2024, at 6:54 AM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc> for the detailed info!
I updated to the latest OneDrive version for Mac (the preview one) and I cannot recreate the issue. Can you please test Guido's version of GetLocalPath <https://gist.github.com/guwidoe/038398b6be1b16c458365716a921814d> and see if that has the same issue on the other Mac?
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF56XIJ4Y64FPZKES5TZYKI47AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTG42DQMJSGI>.
You are receiving this because you were mentioned.
|
Another update… Now it’s happening on My computer (Mac) out of the blue today. I’m not getting any message, but the LocalPath in my Debug.Print when calling GetLocalPath using the workbook full path from excel, is empty. I reset OneDrive, no change. I signed out of Excel, and back in (to reconnect the OneDrive account within Excel), no change.
I restarted the Mac, and then it worked. The above line then showed the full path properly. It’s the same thing that happened on the other computer. I though resetting OneDrive resolved it, but it was actually restarting the Mac (which explains why when I did the reset OneDrive hing Twice on the other computer, it worked the second time - I think I restarted the computer after I ran it the second time).
Ps this was the newer code you updated.
Ryan Taliercio
***@***.***
… On Sep 25, 2024, at 6:54 AM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc> for the detailed info!
I updated to the latest OneDrive version for Mac (the preview one) and I cannot recreate the issue. Can you please test Guido's version of GetLocalPath <https://gist.github.com/guwidoe/038398b6be1b16c458365716a921814d> and see if that has the same issue on the other Mac?
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF56XIJ4Y64FPZKES5TZYKI47AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTG42DQMJSGI>.
You are receiving this because you were mentioned.
|
I don't know how to do this but I don't think it's necessary. Once permission is granted the file can be accessed and if permission is denied then next time the macro tries to accesss the file then the Grant Access dialog pops-up anyway.
I moved a folder that was synced via a shortcut. Nothing I did updated the ini file under OneDrive settings. Until I restarted. This indeed seems to be a OneDrive issue and it makes sense why the code is not working - because it's reading obsolete information. And this was on Windows. On Mac is the same. It almost feels that we would need to find a way to force update the settings files that OneDrive is using. Maybe there is a way to automate this but I would have to read the Microsoft documentation, if I can find the correct one and if even possible from VBA. Thanks for now! I wiill leave this open until I find the time to delve into it properly. |
An error is appearing now on windows, 2 computers, could be more but don’t know.
ERROR HERE: Runtime Error 9, subscript out of range:
ReDim Preserve outdirs.arrDirs(1 To outdirs.dirCount)
in the below:
Loop Until lastRecord > size
ReDim Preserve outdirs.arrDirs(1 To outdirs.dirCount)
CloseFile:
Close #fileNumber
End Sub
Ryan Taliercio
***@***.***
… On Sep 25, 2024, at 6:54 AM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc> for the detailed info!
I updated to the latest OneDrive version for Mac (the preview one) and I cannot recreate the issue. Can you please test Guido's version of GetLocalPath <https://gist.github.com/guwidoe/038398b6be1b16c458365716a921814d> and see if that has the same issue on the other Mac?
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF56XIJ4Y64FPZKES5TZYKI47AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTG42DQMJSGI>.
You are receiving this because you were mentioned.
|
Thanks @dcircleinc I just pushed a new version. Can you please test it? If it still fails can you please provide me with the version of OneDrive where the code fails? |
I get this on Mac, invalid procedure call or argument (error 5)
error here: syncDir = collSyncIDToDir(.syncID)
#If Mac Then
If collSyncIDToDir.Count > 0 Then 'Replace sandbox paths
For i = 1 To m_providers.pCount
With m_providers.arr(i)
Dim syncDir As String: syncDir = collSyncIDToDir(.syncID)
.mountPoint = Replace(.mountPoint, .baseMount, syncDir)
End With
Next i
End If
#End If
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 6:59 AM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc>
I just pushed a new version. Can you please test it? If it still fails can you please provide me with the version of OneDrive where the code fails?
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF6J6A7RY42ZXWAWUJTZZJ6CNAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBVGQ3TEMRRGQ>.
You are receiving this because you were mentioned.
|
I think the error may be in the line:
Dim syncDir As String: syncDir = collSyncIDToDir(.syncID)
I don’t think the “.” should be there, not sure but I think it should be:
Dim syncDir As String: syncDir = collSyncIDToDir(syncID)
??
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 6:59 AM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc>
I just pushed a new version. Can you please test it? If it still fails can you please provide me with the version of OneDrive where the code fails?
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF6J6A7RY42ZXWAWUJTZZJ6CNAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBVGQ3TEMRRGQ>.
You are receiving this because you were mentioned.
|
MAC Version on OneDrive:
23.214.1015.0001
But I replaced .syncID with syncID and it works, I didn’t see a WITH so I assume it should be syncID, unless I missed it.
But, this makes it work, which is weird since this same code has been working with this line in it with .syncID.
I wonder if OneDrive changed so now it’s executring this part of the code, whereas before it didn’t execute this part so the error wasn’t encountered. Though I think VBA would want me when I saved it that it wouldn’t compile.
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 6:59 AM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc>
I just pushed a new version. Can you please test it? If it still fails can you please provide me with the version of OneDrive where the code fails?
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF6J6A7RY42ZXWAWUJTZZJ6CNAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBVGQ3TEMRRGQ>.
You are receiving this because you were mentioned.
|
Yes, it does. It refers to the Could you please try the latest code? Just pushed a minor change. |
Thank you, tried newest code. I get no error on the MAC but it returns an empty path when calling GetRemotePath(ThisWorkbook.FullName)
ThisWorkbook.fullName returns something like https://d.docs.live.net/asdlkjaskldjkal/aslkdalkdjakl/adslkadaskl/ActualFileName, so it seems it’s passing the right value to the function.
When I reverted and removed the .syncID and set it to synciD ,it returns the path properly, but since that’s supposed to be there, I’m not sure how or why it works.
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 11:22 AM, Cristian Buse ***@***.***> wrote:
@dcircleinc <https://github.com/dcircleinc>
I don’t think the “.” should be there
Yes, it does. It refers to the m_providers.arr(i).syncID from the enclosing With block.
Could you please try the latest code? Just pushed a minor change.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF35GD4GA6ED6WUC2U3ZZK42HAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBWGMYDENZVGI>.
You are receiving this because you were mentioned.
|
This is very interesting. It should not work. I need to update the Thanks for all the feedback! |
Could you please update the latest version and run the Many thanks! |
Thanks for the diagnostics data. I deleted the data because it was in issue #29. It seems, the code cannot read the following:
Your configuration must be different than mine. I will look into this and let you know. |
Hope it helps, it’s so frustrating that it works for a few weeks and then something changes and it stops working (mostly on Mac).
You’re doing an amazing job.
This is what I get when I used “syncID" and spit back the local path returned from:
GetLocalPath(thisworkbook.FullName):
"/Users/ryan/Library/CloudStorage/OneDrive-Personal/subdirectory/subdirectory2” and this worked.
In order to get this to work on the Mac, I had to add this, and for whatever reason, it returns the correct local path with syncID and not .syncID.
It seems .syncID worked sometimes.
On Error Resume Next
.syncDir = collSyncIDToDir(.syncID)
If (Err.Number <> 0) Then
.syncDir = collSyncIDToDir(syncID)
End If
.mountPoint = Replace(.mountPoint, .baseMount, .syncDir)
On Error GoTo 0
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 4:53 PM, Cristian Buse ***@***.***> wrote:
@dcircleinc <https://github.com/dcircleinc>
Thanks for the diagnostics data. I deleted the data because it was in issue #29 <#29>.
It seems, the code cannot read the following:
the main mount location - I would expect this to be something like /Users/ryan/Library/CloudStorage/OneDrive-Personal/
the sync paths
Your configuration must be different than mine. I will look into this and let you know.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDFZT4JII56IE72E5R7TZZMDS3AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXGA2TGNRRGE>.
You are receiving this because you were mentioned.
|
Thanks again for all the help so far. I still need some more info if possible. In the As for the sync IDs, there should be a file called |
Ryan Taliercio
***@***.***
On Oct 1, 2024, at 5:32 PM, Cristian Buse ***@***.***> wrote:
Thanks again for all the help so far. I still need some more info if possible.
In the 95bbe8e999b9a6af.ini file, the first line should be like library = .... I would need that line to see why the mount point is not being read. This file can be found at: /Users/ryan/Library/Application Support/OneDrive/settings/.
I can’t find this directory nor the .ini file. I searched for the .ini as well, no result
As for the sync IDs, there should be a file called .849C9593-D756-4E56-8D6E-42412F2A707B at: /Users/ryan/Library/CloudStorage/OneDrive-Personal/. You might need to CTRL+Shift+. from keyboard (Command+Shift+Dot). The contents of the file should look like this: {"guid" : "564ad8ab-4e36-4f3a-9eff-0ae1bb13a24d","version" : 1}. Is the file there and what is the content?
Content of that file is:
{"guid" : "60f16864-3de4-4936-a61f-2be2e8e7777a","version" : 1}
… —
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDFY7LFDZFNNHEKZZWHDZZMIIXAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXGEYTIMRVGU>.
You are receiving this because you were mentioned.
|
Maybe here: |
On Oct 1, 2024, at 5:56 PM, Cristian Buse ***@***.***> wrote:
/Users/ryan/Library/Containers/com.microsoft.OneDrive-mac/Data/Library/Application Support/OneDrive/settings/
Found it in Users/ryan/Library/Containers/com.microsoft.OneDrive-mac/Data/Library/Application Support/OneDrive/settings/Personal - but it will not let me open it. I tried copying it and it says the file is “damaged”. I closed OneDrive and tried, same thing.
Then a strange thing, when I opened onedrive it made me sign in again.
Now I opened the other file and the guid is different:
{"guid" : "d4634849-bed4-43dc-b6e8-bf6b226358a5","version" : 1}
|
Try opening with TextEditor app. If it still does not open then please send me the file at [email protected] Weird that the guid updated. The one starting with 6 looked wrong anyway. |
Sorry, I don’t know what happened now. When I tried to open that file, even in textedit. it wouldn’t open.
Then onedrive had me sign in again, and it keeps saying now I have 2 of the same onedrive accounts running, and i’m in a loop.
I try to delete one, and then the same thing happens when I sign in, so I’m stuck.
Here was the ini file from previous that I was unable to open.

Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 6:39 PM, Cristian Buse ***@***.***> wrote:
Try opening with TextEditor app. If it still does not open then please send me the file at ***@***.*** ***@***.***>
Weird that the guid updated. The one starting with 6 looked wrong anyway.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF6DPBOF4IAWUUHUZNTZZMQB7AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXGIYDQMZZGQ>.
You are receiving this because you were mentioned.
|
I was able to open it in windows notepad. Textedit on mac wouldn’t do it:
library = 1 4 95BBE8E999B9A6AF!103 327456003 "SkyDrive" Me personal "/Users/ryan/Library/Group Containers/UBF8T346G9.OneDriveSyncClientSuite/OneDrive.noindex/OneDrive" 1 564ad8ab-4e36-4f3a-9eff-0ae1bb13a24d - 197948186 16777229 D2A0343F-60C2-4785-B278-FE4D7F8DEAAB
installID = 1
originatorID = 5fc35e4b-4ba5-4d18-bfe2-01e439c50250
The path is to this 849C9593-D756-4E56-8D6E-42412F2A707B file
is now: /Users/ryan/Library/CloudStorage/OneDrive
The GUID in the new file now that I had to reinstall again is:
{"guid" : "eaaa01d4-9a8d-43cb-879c-f364c86c2151","version" : 1}
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 6:39 PM, Cristian Buse ***@***.***> wrote:
Try opening with TextEditor app. If it still does not open then please send me the file at ***@***.*** ***@***.***>
Weird that the guid updated. The one starting with 6 looked wrong anyway.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF6DPBOF4IAWUUHUZNTZZMQB7AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXGIYDQMZZGQ>.
You are receiving this because you were mentioned.
|
If this helps, I opened up a different file (which is using the same methods) after reinstalling OneDrive.
I got an error in:
If i > 0 Then
relPath = Mid$(lineText, i + 8)
folderID = Left$(lineText, i - 1)
If oDirs.dirCount = 0 Then ReadODDirs aInfo, oDirs
With m_providers.arr(AddProvider())
.webPath = mainURL & cID & "/" & relPath & "/"
relPath = oDirs.arrDirs(oDirs.idToIndex(folderID)).dirName
.mountPoint = BuildPath(mainMount, relPath & "/")
.baseMount = mainMount
.syncID = syncID
End With
End If
I left the file open, quit onedrive, opened it again, and the erorr disappeared and the proper path was returned.
I haven’t tried again to exit onedrive, start again, and then open Excel and see what happens.
Ryan Taliercio
***@***.***
… On Oct 1, 2024, at 6:39 PM, Cristian Buse ***@***.***> wrote:
Try opening with TextEditor app. If it still does not open then please send me the file at ***@***.*** ***@***.***>
Weird that the guid updated. The one starting with 6 looked wrong anyway.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF6DPBOF4IAWUUHUZNTZZMQB7AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBXGIYDQMZZGQ>.
You are receiving this because you were mentioned.
|
OneDrive has probably updated on your computer(s) but it kept files in different places and now it's all "confused" about it. Could you please use the latest version of this repo (did some changes last night) and re-run the ``CreateODDiagnosticsFile``` method? Thanks! |
I replaced with new verision, attached is the file.
Local path appears to be returning incorrect intermittently, but I get no error (I only see an error in my code because I have a check that creates a subfolder, and it can’t find the path the function returns, and spits back an error. When I check the path its as below, and somewhere on the root that doesn’t exist.
Folder Path Initial: https://d.docs.live.net/d60675b8af8da0f7/DesignCenter Cash Sheets/Cash_Sheet_10_2024_Design Center.xlsm
Folder Path Remote to Local (GetLocalPath) : /Folder1/filename.xlsm
When I close Excel and restart, it works and returns the actual local long “cloud” path. It seems to be random.
When I get that incorrect path returned, If I put in the If statmenet for the .syncID to return syncID instead, it returns the full cloud path correctly.
Ryan Taliercio
***@***.***
:
On Oct 2, 2024, at 6:09 AM, Cristian Buse ***@***.***> wrote:
Then onedrive had me sign in again, and it keeps saying now I have 2 of the same onedrive accounts running, and i’m in a loop.
OneDrive has probably updated on your computer(s) but it kept files in different places and now it's all "confused" about it.
Could you please use the latest version of this repo (did some changes last night) and re-run the ``CreateODDiagnosticsFile``` method? Thanks!
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF4JO52SDDTHRLEAXLLZZPA6DAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBYGI2DCNZZGA>.
You are receiving this because you were mentioned.
Mac VBA7 x64
…--------------------------------------------------------------------------------
Accounts found: 2
Name: Personal
ID: 95bbe8e999b9a6af
Has DAT: False
Is Valid: True
Name: Personal
ID: 95bbe8e999b9a6af
Has DAT: True
Is Valid: False
--------------------------------------------------------------------------------
Providers found: 8
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/95bbe8e999b9a6af/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /_Seigermans CASH SHEETS/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/de05781aea838628/Documents/Seigermans CASH SHEETS/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /__CASHSHEET TEMPLATES/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/d60675b8af8da0f7/CASHSHEET TEMPLATES/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /_Natuzzi Cash Sheets/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/8cc293ffa7f430b9/Natuzzi Cash Sheets/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /_110 CASH SHEETS/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/51207bab5645f67e/CASH SHEETS IN HERE/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /_SHOWPLACE CASHSHEETS/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/39e895601e7750c9/Desktop/CASHSHEETS/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /_DesignCenter Cash Sheets/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/d60675b8af8da0f7/DesignCenter Cash Sheets/
Sync Dir:
Base Mount: $Group.Container$/OneDrive.noindex/OneDrive
Is Business: False
Is Main: False
Mount Point: /_Sofabed Cashsheets/
Sync ID: d641d3be-9319-40bf-bff0-a1e0f977e0ba
Web Path: https://d.docs.live.net/d60675b8af8da0f7/Sofabed Cashsheets/
Sync Dir:
|
Ok, so the problem still lies with the Sync IDs and apparently for some reason the Main Mount is blank until you restart. Hopefully last thing I ask, can you please put the below code into a new module, run the Option Explicit
Sub PrintSyncIDs()
Const syncIDFileName As String = ".849C9593-D756-4E56-8D6E-42412F2A707B"
Dim collCloudDirs As Collection: Set collCloudDirs = GetODCloudDirs()
Dim collFiles As New Collection
Dim odCloudDir As Variant
Dim arrPaths() As String
Dim syncID As String
Dim fileName As String
Dim folderPath As String
Dim i As Long
'
For Each odCloudDir In collCloudDirs
collFiles.Add odCloudDir
collFiles.Add odCloudDir & "/" & syncIDFileName
Next odCloudDir
arrPaths = CollectionToStrings(collFiles)
If Not GrantAccessToMultipleFiles(arrPaths) Then Exit Sub
'
Set collFiles = New Collection
For Each odCloudDir In collCloudDirs
syncID = ReadSyncID(odCloudDir & "/" & syncIDFileName)
If LenB(syncID) > 0 Then
Debug.Print odCloudDir, syncID
Else
fileName = Dir(odCloudDir & "/", vbDirectory)
Do While LenB(fileName) > 0
folderPath = odCloudDir & "/" & fileName
collFiles.Add folderPath
collFiles.Add folderPath & "/" & syncIDFileName
fileName = Dir
Loop
End If
Next odCloudDir
If collFiles.Count > 0 Then
arrPaths = CollectionToStrings(collFiles)
If Not GrantAccessToMultipleFiles(arrPaths) Then Exit Sub
'
For i = LBound(arrPaths) To UBound(arrPaths) Step 2
syncID = ReadSyncID(arrPaths(i + 1))
If LenB(syncID) > 0 Then Debug.Print arrPaths(i), syncID
Next i
End If
End Sub
Private Function GetODCloudDirs() As Collection
Dim coll As New Collection
Dim cloudPath As String: cloudPath = GetCloudPath()
Dim folderName As String: folderName = Dir(cloudPath, vbDirectory)
'
Do While LenB(folderName) > 0
If folderName Like "OneDrive*" Then
coll.Add BuildPath(cloudPath, folderName)
End If
folderName = Dir
Loop
Set GetODCloudDirs = coll
End Function
Private Function GetCloudPath() As String
GetCloudPath = GetUserPath() & "Library/CloudStorage/"
End Function
Private Function GetUserPath() As String
GetUserPath = "/Users/" & Environ$("USER") & "/"
End Function
Private Function CollectionToStrings(ByVal coll As Collection) As String()
If coll.Count = 0 Then
CollectionToStrings = Split(vbNullString)
Exit Function
End If
'
Dim res() As String: ReDim res(0 To coll.Count - 1)
Dim i As Long
Dim v As Variant
'
For Each v In coll
res(i) = v
i = i + 1
Next v
CollectionToStrings = res
End Function
Private Function ReadSyncID(ByRef syncFilePath As String) As String
Dim b() As Byte: ReadBytes syncFilePath, b
Dim parts() As String: parts = Split(StrConv(b, vbUnicode), """guid"" : """)
'
If UBound(parts) < 1 Then Exit Function
ReadSyncID = Left$(parts(1), InStr(1, parts(1), """") - 1)
End Function |
I forgot to mention, the code above must be placed in the same project as the |
It was /Users/ryan/Library/CloudStorage/OneDrive-Personal 3b7c602a-3493-42c7-8064-7f39a156338d
It seems to be working at the moment, but the other day I had the same problem suddenly so I had to comment the .synciID again, but this time it worked without the error trapped and .syncID replaced with syncID value.
Just in case, I’m writing an alternate method using DIR and similar functions on Mac. I take the currently open file and search the user’s onedrive for the file. I get the onedrive path from ENVIRON(“HOME”) and append “CloudStorage” (removing the com.microsoft.excel path that it returns). Then I search that directory for the file name, and then use that as a possible starting point to set the local directory. In my case this work since the filename is unique for the user. I also sort the results of the DIR loop by newest first - since they have the document open and it saves just before running, it should be the first on the list if there are matches. I have this working in both windows and Mac so far.
Ryan Taliercio
***@***.***
… On Oct 4, 2024, at 11:23 AM, Cristian Buse ***@***.***> wrote:
I forgot to mention, the code above must be placed in the same project as the LibFileTools module as it uses a few methods from it.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDFYZ2BYTKRZUNQUOBODZZ2XF5AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJTHE2TEMBTGM>.
You are receiving this because you were mentioned.
|
Still, It makes absolutely no sense that it works with syncID instead of .syncID. The former is the result of the last I wish I was able to debug this myself. It's driving me nuts as I cannot replicate. |
Let me try to recreate the scenario, disable the error catching, and I’ll then run the PrintSyncID tool.
It also happened on a windows computer when I removed a shared folder for a user, and readded them with a new OneDrive account. When I opene the file in excel, I got an error in the same part of the code. When I then exited onedrive, without restarting excel, the script worked. When I started onedrive again, it was fine. Please note this new Onedrive account was added to Excel as well.
I had to add a new account for this user as that particular computer got that OneDrive worldwide bug where shared folders do not appear in the onedrive app, and appear as shortcuts only in their folder. When clicking on these, they take you to the web version of the page. There are no local folders associated with the shared folder. Microsoft hasn’t been able to fix it. The account was fine then suddenly the folders were replaced with shortcuts. I have no solution other than to add new dummy accounts.
Ryan Taliercio
***@***.***
… On Oct 4, 2024, at 12:27 PM, Cristian Buse ***@***.***> wrote:
Still, It makes absolutely no sense that it works with syncID instead of .syncID. The former is the result of the last syncID = ReadSyncID(... that happened in the same method and should be already added to the collSyncIDToDir collection as a key.
I wish I was able to debug this myself. It's driving me nuts as I cannot replicate.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF3E6WQI6J5E4R5UCNLZZ26WFAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJUGA3DEMRQGE>.
You are receiving this because you were mentioned.
|
Hi Ryan, Any updates on this? I've been a bit swamped in the last 2-3 weeks and had no chance to revisit. Thanks! |
Was I supposed to send something else ? It sure if I missed something .I still have that line commented out but I removed it and it’s working on my Mac at the moment. It seems so random but may to be tied to when OneDrive updates or is reinstalled/reset. I wrote a brute force method which saves the current file so it has the newest modified date, looks for the “OneDrive” folder name (with wildcards). it starts with a likely default location on Mac and uses the environment variable in windows. It then parses those to find the NEWEST file with the currently open file name just in case there are duplicates, and then uses that as the path to OneDrive (I can strip out the subdirectories if needed) but in my case this is the folder I need. For Mac i have a Macscript method for director parsing and “save as” dialog, but I also added an AppleScripttask and made a little Automator app which automatically copies the proper .scpt I need to execute (to do the parsing/searching) into the Application Scripts / com.Microsoft.excel folder on the user’s Mac. I’m Not sure what functions of Macscript will stop working in the future (or any day) so anything that uses it I’m Afraid might stop working, and I do see the vbafiletools uses Macscript. This is a problem on the Mac when promoting a dialog box with the save as folder and file name pre-selected as Macscript is needed, but the AppleScriptTask version seems to work (slower but it’s just a starting point). This also works on windows and uses the shell “find” commands. Sent from my iPhoneOn Oct 21, 2024, at 4:52 AM, Cristian Buse ***@***.***> wrote:
Hi Ryan,
Any updates on this? I've been a bit swamped in the last 2-3 weeks and had no chance to revisit. Thanks!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
No. But you mentioned that you are writing an alternative method and was wondering if while doing it, you stumbled across the answer of how the issue is happening.
Ok. I think I understand what you've done. Thanks! I will think about this in the next few days and will let you know if any idea comes to mind. |
Here’s another update from testing, where I received an error in this code below in this line, with error “Runtime error 9, Subscript out of range”). In this case there is an “old” onedrive folder, and we connected to the “new” one.
ReDim Preserve outdirs.arrDirs(1 To outdirs.dirCount)
This happens when I added a new OneDrive account to the systtem, add it to Excel Accounts (onedrive access within Excel), and then open the file and attempt to run the library.
If I reboot, the error disappears, but it seems to happen when we just add a new onedrive signin and then attempt to access the library without rebooting.
Private Sub ReadDirsFromDB(ByRef filePath As String _
, ByVal isPersonal As Boolean _
, ByRef outdirs As DirsInfo)
If Not IsFile(filePath) Then Exit Sub
Dim fileNumber As Long: fileNumber = FreeFile()
'
Open filePath For Binary Access Read As #fileNumber
Dim size As Long: size = LOF(fileNumber)
If size = 0 Then GoTo CloseFile
'
Const chunkSize As Long = &H100000 '1MB
Const minName As Long = 15
Const maxSigByte As Byte = 9
Const maxHeader As Long = 21
Const minIDSize As Long = 12
Const maxIDSize As Long = 48
Const minThreeIDSizes As Long = minIDSize * 3
Const maxThreeIDSizes As Long = maxIDSize * 3
Const leadingBuff As Long = maxHeader + maxThreeIDSizes
Const headBytesOffset As Long = 15
Const bangCode As Long = 33 'Asc("!")
Dim curlyStart As String: curlyStart = ChrW$(&H7B22) '"{
Dim quoteB As String: quoteB = ChrB$(&H22) '"
Dim bangB As String: bangB = ChrB$(bangCode) '!
Dim sig As String
Dim b(1 To chunkSize) As Byte
Dim s As String
Dim lastRecord As Long
Dim i As Long
Dim j As Long
Dim k As Long
Dim idSize(1 To 4) As Long
Dim nameSize As Long
Dim dirID As String
Dim parentID As String
Dim dirName As String
Dim nameEnd As Long
Dim nameStart As Long
Dim isASCII As Boolean
Dim mustAdd As Boolean
Dim idPattern As String
'
idPattern = Replace(Space$(12), " ", "[a-fA-F0-9]")
If isPersonal Then
sig = bangB
idPattern = "*" & idPattern & "![a-fA-F0-9]*"
Else
sig = curlyStart
idPattern = idPattern & "*"
End If
Do
Dim currFileChange As Date: currFileChange = FileDateTime(filePath)
Dim lastFileChange As Date
'
i = 0
If currFileChange > lastFileChange Then
With outdirs
Set .idToIndex = New Collection
.dirCount = 0
.dirUBound = 256
ReDim .arrDirs(1 To .dirUBound)
End With
lastFileChange = currFileChange
lastRecord = 1
End If
Get fileNumber, lastRecord, b
s = b
i = InStrB(1, s, sig)
Do While i > 0
If isPersonal Then
For j = i - 1 To i - maxIDSize Step -1
If j = 0 Then GoTo NextSig
If b(j) < bangCode Then Exit For
Next j
If (j < maxHeader) Or (i - j < minIDSize) Then GoTo NextSig
Else
j = InStrB(i + 2, s, quoteB)
If j = 0 Then Exit Do 'Next chunk
idSize(4) = j - i + 1
If idSize(4) > maxIDSize Then GoTo NextSig
For j = i - 1 To i - maxThreeIDSizes Step -1
If j = 0 Then GoTo NextSig
If b(j) < bangCode Then Exit For
Next j
If j < maxHeader Then GoTo NextSig
idSize(1) = i - j - 1 'ID 1+2+3
If idSize(1) < minThreeIDSizes Then GoTo NextSig
End If
'
k = j + 1 'ID1 Start
For j = j To j - headBytesOffset + 1 Step -1
If b(j) > maxSigByte Then GoTo NextSig
Next j
If (b(j) <= maxSigByte) And (b(j - 1) < &H80) Then j = j - 1
If b(j) < minName Then j = j - 1
'
nameSize = b(j)
If nameSize Mod 2 = 0 Then GoTo NextSig
nameSize = (nameSize - 13) / 2
If b(j - 1) > &H7F Then
nameSize = (b(j - 1) - &H80) * &H40 + nameSize
j = j - 1
End If
If (nameSize < 1) Or (b(j - 4) = 0) Then GoTo NextSig
'
If isPersonal Then
idSize(4) = (b(j - 1) - 13) / 2
idSize(3) = (b(j - 2) - 13) / 2
idSize(2) = (b(j - 3) - 13) / 2
idSize(1) = (b(j - 4) - 13) / 2
nameStart = k + idSize(1) + idSize(2) + idSize(3) + idSize(4)
Else
If b(j - 1) <> idSize(4) * 2 + 13 Then GoTo NextSig
idSize(3) = (b(j - 2) - 13) / 2
idSize(2) = (b(j - 3) - 13) / 2
idSize(1) = idSize(1) - idSize(2) - idSize(3)
nameStart = i + idSize(4)
End If
For j = 1 To 4
If (idSize(j) < minIDSize) _
Or (idSize(j) > maxIDSize) Then GoTo NextSig
Next j
'
nameEnd = nameStart + nameSize - 1
If nameEnd > chunkSize Then Exit Do 'Next chunk
'
dirID = StrConv(MidB$(s, k, idSize(1)), vbUnicode)
If Not dirID Like idPattern Then GoTo NextSig
'
k = k + idSize(1)
parentID = StrConv(MidB$(s, k, idSize(2)), vbUnicode)
If Not parentID Like idPattern Then GoTo NextSig
'
If isPersonal Then
k = k + idSize(2)
If Not StrConv(MidB$(s, k, idSize(3)), vbUnicode) _
Like idPattern Then GoTo NextSig
If Not StrConv(MidB$(s, k + idSize(3), idSize(4)), vbUnicode) _
Like idPattern Then GoTo NextSig
End If
'
On Error Resume Next
j = outdirs.idToIndex(dirID)
mustAdd = (Err.Number <> 0)
On Error GoTo 0
'
If mustAdd Then
With outdirs
.dirCount = .dirCount + 1
If .dirCount > .dirUBound Then
.dirUBound = .dirUBound * 2
ReDim Preserve .arrDirs(1 To .dirUBound)
End If
.idToIndex.Add .dirCount, dirID
j = .dirCount
End With
With outdirs.arrDirs(j)
.dirName = MidB$(s, nameStart, nameSize)
.isNameASCII = True
For k = nameStart To nameEnd
If b(k) > &H7F Then
.isNameASCII = False
Exit For
End If
Next k
If .isNameASCII Then
.dirName = StrConv(.dirName, vbUnicode)
Else
.dirName = ConvertText(.dirName, codeUTF16LE, codeUTF8)
End If
.dirID = dirID
.parentID = parentID
End With
Else
With outdirs.arrDirs(j)
If (Not .isNameASCII) Or (Len(.dirName) < nameSize) Then
dirName = MidB$(s, nameStart, nameSize)
isASCII = True
For k = nameStart To nameEnd
If b(k) > &H7F Then
isASCII = False
Exit For
End If
Next k
If isASCII Then
.dirName = StrConv(dirName, vbUnicode)
Else
.dirName = ConvertText(dirName, codeUTF16LE, codeUTF8)
End If
.isNameASCII = isASCII
End If
End With
End If
i = nameEnd
NextSig:
i = InStrB(i + 1, s, sig)
Loop
If i = 0 Then
lastRecord = lastRecord + chunkSize - leadingBuff
ElseIf i > leadingBuff Then
lastRecord = lastRecord + i - leadingBuff
Else
lastRecord = lastRecord + i
End If
Loop Until lastRecord > size
ReDim Preserve outdirs.arrDirs(1 To outdirs.dirCount)
CloseFile:
Close #fileNumber
End Sub
Ryan Taliercio
***@***.***
… On Oct 21, 2024, at 8:59 AM, Cristian Buse ***@***.***> wrote:
Was I supposed to send something else ?
No. But you mentioned that you are writing an alternative method and was wondering if while doing it, you stumbled across the answer of how the issue is happening.
I wrote a brute force method ....
Ok. I think I understand what you've done. Thanks!
I will think about this in the next few days and will let you know if any idea comes to mind.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDFZERBXVFGCE2FWX52LZ4T3CRAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRWGYYDMMZVGA>.
You are receiving this because you were mentioned.
|
I’m sorry I didn’t make clear, this was happening on 2 PC’s (not mac). This was when I added a new account to onedrive, connected it within Excel. Then the script giave this error. When I restarted OneDrive manually, or rebooted, the error disappeared.
Ryan Taliercio
***@***.***
… On Sep 23, 2024, at 1:14 PM, Cristian Buse ***@***.***> wrote:
Thanks @dcircleinc <https://github.com/dcircleinc> for raising this and the other issues. I will try to check this tomorrow on my Mac.
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF4SW65HO2TT4JFYQ23ZYBD53AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRYHA4DQOJXGM>.
You are receiving this because you were mentioned.
|
Thanks for the info Ryan! I could look into forcefully terminate the OneDrive process via an API call and possibly restart it. I've done this many years ago but not sure how reliable it would be nowadays or if it's even allowed by modern antivirus software. Before I even go down that rabbit hole, I assume you've already tried to set the |
No I didn’t set rebuildCache to true that I remember. Can you point me to that re ference in the documentation and I’ll try both ways?
Ryan Taliercio
***@***.***
… On Nov 7, 2024, at 4:04 AM, Cristian Buse ***@***.***> wrote:
Thanks for the info Ryan!
I could look into forcefully terminate the OneDrive process via an API call and possibly restart it. I've done this many years ago but not sure how reliable it would be nowadays or if it's even allowed by modern antivirus software.
Before I even go down that rabbit hole, I assume you've already tried to set the rebuildCache argument to True when calling GetLocalPath / GetRemotePath? Thanks!
—
Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF674LYF6ROJEEHULE3Z7MUJTAVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRRGY3TSOBXGA>.
You are receiving this because you were mentioned.
|
I found the reference in the call I’ll try with TRUE for rebuildcache.
Ryan Taliercio
***@***.***
… On Nov 6, 2024, at 11:33 AM, Ryan Taliercio ***@***.***> wrote:
I’m sorry I didn’t make clear, this was happening on 2 PC’s (not mac). This was when I added a new account to onedrive, connected it within Excel. Then the script giave this error. When I restarted OneDrive manually, or rebooted, the error disappeared.
Ryan Taliercio
***@***.***
> On Sep 23, 2024, at 1:14 PM, Cristian Buse ***@***.***> wrote:
>
>
> Thanks @dcircleinc <https://github.com/dcircleinc> for raising this and the other issues. I will try to check this tomorrow on my Mac.
>
> —
> Reply to this email directly, view it on GitHub <#30 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHBDF4SW65HO2TT4JFYQ23ZYBD53AVCNFSM6AAAAABOWLBU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRYHA4DQOJXGM>.
> You are receiving this because you were mentioned.
>
|
Hi Ryan, Was quite busy in the last few weeks with VB6 / VBA is slow to deallocate class instances that I completely forgot to mention that I did an update 2 weeks ago to this repo that makes Would be good to hear from you if the problem still persists in this new version. Many thanks! |
I get "Invalid procedure call or argument" in the following code:
in the code "syncDir = collSyncIDToDir(.syncID)" below:
MAC latest OS. Works on one mac, but not the other.
Reset OneDrive.
The text was updated successfully, but these errors were encountered: