I want to insert a picture into a shape using vba, but......

reyusher

New Member
Joined
Aug 25, 2022
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I want to insert a picture into a shape using vba, but i want the picture to be selected manually from the insert picture window, not from url,
so i need the insert picture but only halfway until before the picture is selected, if possible i want to be able to click the shape itself and then it automatically go to insert picture window
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Put this macro behind every shape, which you want to fill with pictures. Macro works when you click on the shapes (so don't run with F5/F8).

VBA Code:
Sub jec()
 With Application.FileDialog(3)
   If .Show Then ActiveSheet.Shapes(Application.Caller).Fill.UserPicture .SelectedItems(1)
 End With
End Sub
 
Upvote 0
Put this macro behind every shape, which you want to fill with pictures. Macro works when you click on the shapes (so don't run with F5/F8).

VBA Code:
Sub jec()
 With Application.FileDialog(3)
   If .Show Then ActiveSheet.Shapes(Application.Caller).Fill.UserPicture .SelectedItems(1)
 End With
End Sub
Thank you!!!
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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