Displaying image from website

piluso

New Member
Joined
Aug 6, 2015
Messages
4
Hello guys,
I am banging my head on this one.
I would like the spreadsheet to have access to an image online, everytime I open the spreadsheet I want it to retrieve the image and show it.
I am a newbie with macros, so I would appreciate details.

Is there any way of doing it without macros, btw?
Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Code:
Private Sub Workbook_Open()

'Open Image

    Dim URL As String
        URL = Worksheets("Sheet1").Range("A1").Value
            Range("A1").Select  'Change the cell in this line for top left corner of Image position
                    
            ActiveSheet.Pictures.Insert("http://www..........").Select
                                  'Insert Img URL here ^^^^^
End Sub
 
Last edited:
Upvote 0
Thanks!
I see the code working if I press the play button, but if I close and open the excel document, the images don't load by itself and they don't refresh
What could it be?
 
Upvote 0
ensure that you have put it in the correct place,
-in the VBA editor,
- double click (This workbook) in the project window,
- under the play button, ensure you select (Workbook) from the drop down, not...general
- then the dropdown on the right should display (Open)

if you put the code here, it should have the desired effect for you you upon opening

This code however opens the image everytime time the document is opened, so if you never delete the image, after ten opens the image will be overlayed 10 times!!
 
Last edited:
Upvote 0
this needs to be in the "ThisWorkbook" module for it to work on startup
 
Upvote 0
so the Private Sub cannot be manually entered?
when I click on (general) -> Worksheet
on (Declarations) I can't find Open.

The options I have on Declarations are:
Activate
BeforeDoubleClick
BeforeRightClick
Calculate
Change
Deactivate
FollowHyperlink
PivotTableAfterValueChange
PivotTableBeforeAllocateChanges
PivotTableBeforeCommitChanges
PivotTableBeforeDiscardChanges
PivotTableChangeSync
PivotTableUpdate
SelectionChange
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top