Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have the following Macro but it seems that I need the name of the picture along with the extension in order to work, is there a way to include the extensions (.gif, .jpg, .jpeg, and more that I don't know ........) into the Macro so that I don't need to include the picture name with the extension. Thank You. ----------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) Dim myScale As Double If Target.Address < "$L$21" Then Exit Sub 'Select the cell where the picture is placed Application.EnableEvents = False On Error Resume Next ActiveSheet.Shapes("KnownPictureName").Delete On Error GoTo 0 Range("L10").Select 'Insert the picture On Error GoTo NoPic 'this is the one with the link to the file that I need the extension ActiveSheet.Pictures.Insert("C:\Temp\Pix\" & Range("L21").Value).Select GoTo GotPic NoPic: ActiveSheet.Pictures.Insert("C:\Temp\Pix\No Pic.jpg").Select GotPic: 'scale the picture to the width of the column myScale = 42 / Selection.ShapeRange.Height Selection.Name = "KnownPictureName" Selection.ShapeRange.ScaleWidth myScale, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight myScale, msoFalse, msoScaleFromTopLeft Range("L22").Select Application.EnableEvents = True End Sub ----------------------------------------------- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert picture using Macro.. | Excel Programming | |||
Insert picture with macro | Excel Programming | |||
Insert Picture Macro. | Excel Programming | |||
Insert Picture Macro | Excel Programming | |||
INSERT PICTURE IN MACRO | Excel Programming |