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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,215,559
Messages
6,125,517
Members
449,236
Latest member
Afua

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