VBA & Macro Problems

How to Import Microsoft Lists Images into Excel Using VBA

Tauseeq MagsiTauseeq Magsi Nov 10, 2026 868 views

Question details

The user needs to fix a VBA macro designed to import images from Microsoft Lists into Excel, which stopped working due to changes in image names, URLs, or SharePoint paths in the CSV export.

How to Import Microsoft Lists Images into Excel with VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
Exporting data from Microsoft Lists to a CSV file and using a VBA macro in Excel to fetch and insert the associated images from a SharePoint library into the spreadsheet.
Observed behavior
The VBA macro fails to locate and import the images because the Microsoft Lists export now returns hosted SharePoint URLs or altered file names instead of the expected local file name formats.
Before you start

Ensure you have downloaded the latest CSV export from your Microsoft List and verify that your current SharePoint permissions allow access to the image library. It is highly recommended to back up your existing VBA workbook before modifying the code.

Solution 1Recommended

Update VBA to Download Images via Hosted URLs

Modify your Excel VBA script to read the new URL structure provided by the updated Microsoft Lists CSV export, bypassing the old local file path method.

Microsoft Lists occasionally changes how image data is formatted when exported to a CSV file. Instead of outputting a simple file name, it may now export a hosted SharePoint URL.

To resolve this, your VBA macro must be updated to download the image directly from this URL rather than attempting to construct a local SharePoint folder path.

1
Inspect the CSV Export

Open your recently exported CSV file in Excel and check the column containing the image data. Note whether it contains a full URL (e.g., https://domain.sharepoint.com/...) or a modified file name.

2
Adjust the VBA Variable

Open the VBA Editor by pressing Alt + F11. Locate the variable or function in your script that constructs the image path based on the CSV data.

3
Rewrite the Image Fetch Logic

Change the code from using local path constructions (like LoadPicture) to a method that downloads from a URL. You can utilize XMLHTTP requests or the URLDownloadToFile API to fetch the image and save it to a temporary directory before inserting it.

4
Test the Macro

Run the macro on a small sample of rows to verify that the images are successfully downloaded from the SharePoint URLs and inserted into the correct Excel cells.

Update VBA to Download Images via Hosted URLs
SharePoint Authentication: If the URLs require authentication, standard VBA URL download methods might fail. You may need to ensure your Internet Explorer session is authenticated with SharePoint, or use WinHttp.WinHttpRequest to pass your credentials.
Run Macros Seamlessly in WPS Office

Edit and Run Your VBA Macros in WPS Spreadsheet

WPS Spreadsheet offers a robust, built-in VBA environment. You can seamlessly open your Excel macro-enabled workbooks, edit your VBA code to handle new Microsoft Lists URLs, and run your automated image imports without any hassle.

  1. 1. Open Your Workbook in WPS Spreadsheet: Launch WPS Office and open the .xlsm file containing your Microsoft Lists data and the existing image import macro.
  2. 2. Access the VBA Editor: Go to the 'Tools' tab on the top ribbon and click on 'VBA Editor' (or press Alt + F11) to view and edit your code.
  3. 3. Modify the Code: Update the image fetching logic in your VBA script to correctly parse and handle the new SharePoint URLs as diagnosed from your CSV file.
  4. 4. Run the Macro: Click the 'Run' button (or press F5) inside the VBA editor to execute your updated macro directly within WPS Spreadsheet.
High compatibility with Microsoft Excel VBA macros and .xlsm file formats.Built-in VBA editor that functions identically to Microsoft Excel's editor.Free and lightweight software ensuring smooth performance even with heavy automated scripts.Familiar user interface makes transitioning your workflows effortless.
QA img-9

Frequently Asked Questions

Why did my Excel VBA macro suddenly stop importing images from Microsoft Lists?

Microsoft occasionally updates how data is exported from Microsoft Lists to CSV. If the export now provides hosted SharePoint URLs instead of simple file names, your existing VBA macro will fail because it is looking for a local file path that no longer exists in the data.

How can I download an image from a URL using Excel VBA?

You can use the URLDownloadToFile Windows API function or the XMLHTTP object in VBA to fetch the image from the URL provided in the CSV. The script typically saves the image to a temporary local folder before inserting it into your worksheet.

Do I need special permissions to import images from SharePoint via VBA?

Yes. If the images are stored in a secure SharePoint library, your VBA macro must be run in an environment where your user session is already authenticated, or the VBA code itself must be written to pass the necessary credentials.

Can I run my Excel VBA macros in WPS Office?

Yes, WPS Spreadsheet fully supports VBA macros. You can open your .xlsm files, access the built-in VBA Editor, and run or edit your code just as you would in Microsoft Excel.