Hi, I am a Microsoft user just like yourself and I will try my best to help you as much as I can today.
Define HTML Content: Create HTML content that displays the image and sets its size to fit within the dimensions of the WebBrowser control. You'll embed this HTML content into the WebBrowser control.
Update Your VBA Code: Modify your VBA code to load the HTML content into the WebBrowser control instead of directly navigating to the image file. Here's the updated VBA code:
With Me.WebAppLauch . AddressBar = False . StatusBar = False . Visible = True ' Set to true to make sure the control is visible . Navigate "about:blank" ' Navigate to a blank page initially Do While . ReadyState <> 4 Or . Busy DoEvents ' Wait until the WebBrowser control has finished loading Loop
' Define HTML content with CSS to fit the image within the control's dimensions Dim htmlContent As String htmlContent = "<html><head><style type='text/css'>" & _ "body { margin: 0; padding: 0; }" & _ "img { max-width: 100%; max-height: 100%; display: block; margin: auto; }" & _ "</style></head><body>" & _ "<img src='file:///C:/Users/myname/Desktop/LoadingProgress/Launching_Application_Images/Launching_Application.gif' />" & _ "</body></html>"
' Inject HTML content into the WebBrowser control . Document.body.innerHTML = htmlContent End With
In this code:
The Navigate "about:blank" line loads a blank page initially to prepare the WebBrowser control. The htmlContent variable contains the HTML and CSS code to display the image and ensure it fits within the control's dimensions. The img CSS style sets the maximum width and height of the image to 100% of the container size, ensuring that the image fits within the WebBrowser control. The src attribute of the img tag points to the file path of your image. Replace "C:/Users/myname/Desktop/LoadingProgress/Launching_Application_Images/Launching_Application.gif" with the actual file path of your image.
See if that helps! Please let us know if you have any questions. Microsoft Support is available for further assistance if the issue continues.
Best regards Deeksha