VBA Code to Open a Picture(Locations will vary) and then insert it into a worksheeet and Resize it all with one button

jlang000

New Member
Joined
Jan 29, 2018
Messages
1
So, I want to be able to click a button that will open a window and let me Navigate to a location where pictures are located, then when I select the picture I want, I want it to insert it in to an excel worksheet and resize it at the same time. It does not have to be a certain cell that it puts it in. The locations will always be differenct and so will file names so i am trying to make it "variable" so to speak. or "Dynamic", what every the proper word is.

I have the following code but clearly i am not there yet.
Can any one help me out here?

Sub InsertPictAndResizeIt()
'
' InsertPictAndResizeIt Macro
Dim MyPict As String
Dim PictFolderPath As Variant
PictFolderPath = "c:\Users"
MyPict = Application.GetOpenFilename
If MyPict = "False" Then Exit Sub
'MyPict.Show
'
Sheet5.Pictures.Insert ("MyPict" & "PictFolderPath")
'ActiveSheet.Pictures.Insert.MyPict '( _
'"C:\Users\jlang\Desktop\Reddog VIP\Pictures\2007\20171214_131746.jpg").Select
Selection.ShapeRange.IncrementLeft -706.5
Selection.ShapeRange.IncrementTop -175.5
Application.CommandBars("Format Object").Visible = False
Selection.ShapeRange.Height = 194.4
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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