Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2025, 03:02 PM
MartinGM MartinGM is offline Problems with Excel VBA and OneDrive Windows 11 Problems with Excel VBA and OneDrive Office 2021
Competent Performer
Problems with Excel VBA and OneDrive
 
Join Date: May 2023
Location: England
Posts: 108
MartinGM is on a distinguished road
Default Problems with Excel VBA and OneDrive

I wonder if anyone else has spotted these issues, and whether thay have found better solutions than my clumsy efforts ?



I have a reliable and reasonably fast internet connection: download 60mbps, upload 15mbps, ping times around 20ms.

1. Opening a downloaded file

I have a procedure which downloads a file from the internet, loops to see if it is there - then opens it when it is detected.

I do this so that I can "time-out" the procedure if it loops more than a defined number of times. This is necessary as the file isn't always available and I didn't want to get stuck in a VBA loop.

This worked fine until I moved to Excel 365 and put my files into the OneDrive folders. At this point VBA sometimes crashed running my download procedure.

I eventually diagnosed this to VBA being too quick (or OneDrive being too slow) - it detects the file before it is fully downloaded and then cannot open it.

I solved this by putting my download folder outside the OneDrive area and normal service was resumed.

2. Saving and closing a file

Recently I have been having problems with a simple "save and close" procedure in a different workbook. It had been working OK but now, although it successfully saves the workbook locally, OneDrive often comes up with an error "This file is in use by another user" which it certainly isn't.

I have solved this, I think, by putting a delay betwen the save and the close sections of the code. So far so good.

Question

My solutions seems rather clumsy and awkward and I was wondering if there's a more elegant way to manage the opening and closing of files stored in the OneDrive area ?

I don't like putting fixed delays into procedures because I never know just how slow the offending transaction might be - hence the loop to detect a downloaded file.

Thanks
Reply With Quote
  #2  
Old 01-26-2025, 02:39 AM
ArviLaanemets ArviLaanemets is offline Problems with Excel VBA and OneDrive Windows 8 Problems with Excel VBA and OneDrive Office 2016
Expert
 
Join Date: May 2017
Posts: 949
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

I had similar issues, (e.g for Excel converters which did read info e.g. from clients forecasts, converted the data to format acceptable by our ERP program, and then saved the result file into folder in our LAN), and for me the solution was to store all such Excel workbooks to shared resource in our LAN. Users opened their workbooks from this shared resource without any further problems.
Reply With Quote
  #3  
Old 01-26-2025, 03:59 PM
MartinGM MartinGM is offline Problems with Excel VBA and OneDrive Windows 11 Problems with Excel VBA and OneDrive Office 2021
Competent Performer
Problems with Excel VBA and OneDrive
 
Join Date: May 2023
Location: England
Posts: 108
MartinGM is on a distinguished road
Default

Yes, that sounds like the same issue.

In the case of opening a dowloaded file, it looks as though the file is responding with a file length (which is how I check if it is there) before it is ready to be opened.

I wonder if there is a different check I could use which will give a positive response once the file can be opened ?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
A tip about using Excel VBA with OneDrive MartinGM Excel Programming 2 08-12-2024 12:09 AM
Excel, hyperlink to OneDrive file, is this possible The9codgerDrove Excel 0 08-15-2022 04:32 AM
Problem with hyperlinks to Excel workbooks on OneDrive rjxb Excel 0 08-28-2018 10:06 AM
OneDrive + iPhone Excel: Cannot Update Workbook? markg2 Excel 0 12-07-2014 09:02 AM
Excel function does not work in OneDrive for Business Laibiang Excel 0 11-04-2014 07:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft