(Solved) – URLDownloadToFileW Sharepoint download URL with unicode characters in VBA

(solved)-–-urldownloadtofilew-sharepoint-download-url-with-unicode-characters-in-vba

I have found that downloading a non-unicode Sharepoint Excel file from VBA using URLDownloadToFile works well. However, if the URL has unicode characters (Chinese) then I see that URLDownloadToFileW is required. However, I have not been able to get it to work. The URL is in the Excel Workbook.FullName.

ex.

ret = URLDownloadToFileW(0, ActiveWorkbook.FullName, sAttachFilename, 0, 0)

In this case, ret is non-0. I have tried:

ret = URLDownloadToFileW(0, StrConv(ActiveWorkbook.FullName,vbUnicode, sAttachFilename, 0, 0)

Same result.

Has anyone been able to download unicode URLs in VBA?

Leave a Reply

Your email address will not be published. Required fields are marked *