VBA : Change Picture Name From 1_1.jpg To ONLY 1.JPG, etc....

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all....

how to make this code work if the picture is series number not adding mark "_"
i must give the file name always e.q. 1_1.jpg;2_1.jpg; 3_1.jpg, ect...

i want the picture name like 1.jpg;2.jpg;3.jpg NOT USE "_1"...
here this code :
Code:
Sub ReplaceImages()    If Range("AM8") = "" Then Exit Sub
    Dim MyPic As String
    For i = 1 To 4
        MyPic = "g:\foto_dino\" & Range("AM8").Value & [COLOR=#ff0000]"_" & i[/COLOR] & ".jpg"
        With Me.Shapes("Pic[COLOR=#ff0000]_" & i[/COLOR]).Fill
            .Visible = msoTrue
            On Error Resume Next
            .UserPicture MyPic
        End With
    Next i
End Sub

any help, thank in advance...

susanto
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,215,482
Messages
6,125,058
Members
449,206
Latest member
Healthydogs

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