Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
549 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Hi Andrew, Thanks for all those great explanations and videos you have on VBA scripting.Recently , i was trying to work on copyng an excel file from my Microsoft 365 sharepoint path to my local desktop folder.I have used the same code which you have explained in your video.But ,The file gets created in the respective local path .But , When i open the copied file its blanka nd it throws an error message "The excel cannot open this file "XXXXXXX.xlsx"because the fiel format or file extentionis not valid.Verify that the file has not been corrupted and that teh file extension matches the format of the file"
I have used the below code to copy file from sharepoint.
Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" ( _
ByVal pCaller As LongPtr, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As LongPtr, _
ByVal lpfnCB As LongPtr _
) As Long
Sub URLDownloadURLWeb()
Dim FileURL As String
Dim DestinationFile As String
FileURL = "https://sharepoint.com/sites/WestESG/_layouts/15/Doc.aspx?sourcedoc=%7BDA181359-66E3-4C4F-BD2E-8E2DE44D5CB3%7D&file=Tracker_data.xlsx&action=default&mobileredirect=true&CT=1622699547701&OR=ItemsView"
DestinationFile = "C:\Desktop\macro\Tracler_Data.xlsx"
URLDownloadToFile 0, FileURL, DestinationFile, 0, 0
End Sub
Note: I have using Microsoft office 365 Proplus- Excel
OS is a 64 bit
Kindly help me in sorting this issue
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.