Display GIF Images in Excel 2016 Using the Web Browser Control
Question details
The user wants to display and change GIF images in Excel 2016 using VBA and the Microsoft Web Browser control.

- Product
- Microsoft Excel 2016
- Device & OS
- not provided
- Scenario
- A worksheet uses a Web Browser control to load local GIF files, with the goal of changing images through VBA and showing a transparent area when no image is displayed.
- Observed behavior
- The control can produce VBA errors, and a proposed COM Compatibility registry change did not work as intended.
Check that the GIF file exists and that the worksheet has a Web Browser control named WebBrowser1. Use only a trusted workbook and check your organization's ActiveX and macro policies before running VBA.
Load a Local GIF with the Existing Web Browser Control
Use this approach only when the legacy control is already available and permitted in your environment.
The Microsoft Web Browser control is obsolete and has security and compatibility risks. The original discussion refers to removing a COM Compatibility registry key, but does not identify a specific key or establish that setting its DWORD to zero is equivalent. Do not change or delete an unspecified registry entry.
On the worksheet, open Developer > Design Mode and select the browser control. Open Properties and confirm that its name is WebBrowser1, or adjust the VBA code to match its actual name.
Right-click the worksheet tab, select View Code, and add: Private Sub Worksheet_Activate() Me.WebBrowser1.Navigate "F:\test.gif" End Sub. Replace F:\test.gif with the full path to your GIF.
Close the VBA editor, turn off Developer > Design Mode, then switch to another worksheet and back. Allow macros only if you trust the workbook.
To load another GIF, call Me.WebBrowser1.Navigate with that file's full path from a suitable worksheet event or VBA procedure.
Insert the GIF as a Worksheet Picture
Use a worksheet picture when you only need to show an image and do not need the legacy browser control.
Insert GIF Images in Spreadsheets with WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and support for Microsoft Office formats, making it easy to bring existing spreadsheets into WPS. It does not fix Excel's Web Browser control or registry errors.

Frequently Asked Questions
Why does the Web Browser control produce a VBA error?
The control is obsolete, and availability, ActiveX restrictions, compatibility settings, or an incorrect control name can prevent it from working. Check Developer > Design Mode and Properties for the control name, and verify that the GIF path is valid.
Can I set the COM Compatibility DWORD to zero instead of deleting the key?
The supplied information does not establish that these changes are equivalent or identify the exact key involved. Consult an administrator and applicable Microsoft guidance before changing registry settings.
Can VBA display a different GIF in the same browser control?
Yes, if the control works in your environment. Call Me.WebBrowser1.Navigate with the full path of the desired GIF from an appropriate worksheet event or VBA procedure.
Will an inserted GIF animate in Excel?
Not necessarily. A GIF added through Insert > Pictures may appear as a static image, so test it in your Excel version if animation is important.
How can I make the area transparent when no GIF is shown?
The browser-control method does not establish a reliable transparent empty state. For a static picture, select it and press Delete to expose the worksheet underneath.




