Rename image after inserting

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
955
I'm using this code to insert an image to my sheet from my local drive. However, I can't seem to rename the image. The third line is suppose to rename the image, but after the image is inserted, its not selected. Therefore the image is not being renamed. Can someone help.. Thank you

VBA Code:
Sub Macro1()
ActiveSheet.Shapes(Application.Caller).TopLeftCell.Select
ActiveSheet.Pictures.Insert ActiveCell.Comment.Text
Selection.Name = ActiveCell.Value
End Sub
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
955
I know I can resize the image using the PictureSizeMode, but the image quality is diminished. How can i resize the picture without diminishing the image quality?
I have a code that exports a chart to the computer and then loads the chart to a userform, but having a difficult time adapting it to an image.

VBA Code:
Dim MyChart As Chart
Dim FName As String

Set Wks = ActiveSheet

Set MyChart = Wks.Shapes("chGrade").Chart
FName = VBA.Environ("TEMP") & Application.PathSeparator & "MyChart.jpg"
MyChart.Export FName
Image1.Picture = LoadPicture(FName)
Kill FName
 

Watch MrExcel Video

Forum statistics

Threads
1,127,355
Messages
5,624,207
Members
416,017
Latest member
moritz210

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
Top