SharePoint Document Issues

Load SharePoint Images into an Excel VBA Image Control

Tauseeq MagsiTauseeq Magsi Dec 2, 2026 868 views

Question details

Display a protected SharePoint image, such as a Microsoft Forms upload, in an Excel VBA image control.

How to Load SharePoint Images into an Excel VBA Image Control
Product
Microsoft Excel, SharePoint, and Microsoft Forms
Device & OS
not provided
Scenario
An Excel VBA macro needs to retrieve an image stored in SharePoint and show it in an image control.
Observed behavior
A SharePoint image downloaded from a URL may appear black or fail to display when the request cannot access the protected image content.
Before you start

Confirm that your Microsoft 365 account can open the original image in SharePoint and that you have access to its document library. Identify the image file itself rather than a sharing link or preview page.

Solution 1Recommended

Load the image from a synchronized SharePoint folder

Use this approach when you can sync the SharePoint library to the computer running Excel.

1
Sync the library

Open the document library containing the image in SharePoint, select Sync, and follow the OneDrive prompts to connect it to your computer.

2
Make the image available locally

In File Explorer, open the synchronized library folder, find the image, and select Always keep on this device if the file is online-only.

3
Check the file

Open the local image in an image viewer. If the VBA image control cannot load its format, save a compatible copy, such as a JPEG or BMP, and use that file instead.

4
Assign the picture

In the VBA editor, set the UserForm image control's Picture property with a local path, for example: Me.Image1.Picture = LoadPicture("C:\Path\To\photo.jpg"). Replace the path and control name with your own.

Load the image from a synchronized SharePoint folder
Paths can differ: The synchronized folder path may vary by user and computer. Check the local path before running the macro.
Free Microsoft Office alternative

Work with Excel files in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Microsoft Office formats, making it easy to move everyday document work between suites. It does not fix authentication or VBA image-control issues in Microsoft Excel.

Open and edit spreadsheets containing images for everyday document workCompatible with Microsoft Excel XLS and XLSX formatsFamiliar interface for a smoother transition from Microsoft OfficeFree and lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does a SharePoint image link work in my browser but not in VBA?

Your browser may already be signed in to Microsoft 365, while URLDownloadToFile makes a request without the same authentication. Use a synchronized local file or an authenticated Microsoft Graph request.

Can I pass a SharePoint sharing link directly to LoadPicture?

LoadPicture should be given a local image file path for this workflow. A sharing link may lead to a preview page rather than the image bytes, so download or sync the actual file first.

How can I tell whether the download returned an image?

Open the saved file in an image viewer. If it does not open, inspect the response status and content type; the download may contain a sign-in page or an error response instead of image data.

What should I do if LoadPicture cannot open a downloaded PNG?

Convert the image to a format supported by the VBA image control, such as JPEG or BMP, and pass the converted file's local path to LoadPicture.