karimretina
New Member
- Joined
- Nov 24, 2016
- Messages
- 4
Hello every body,
I hope every one is safe and healthy
I am trying to insert a jPG picture in a work sheet called "Rx" by suing "active x control" button, the picture is named "Logo" and saved in "C:" ,. Everything is going well except that the picture is not inserted in the target cell "C33"and always inserted in the same false cell. This is the code I'm using:
I have had a look around and confused myself! Any help gratefully received!
Many thanks and stay safe
Karim
I hope every one is safe and healthy
I am trying to insert a jPG picture in a work sheet called "Rx" by suing "active x control" button, the picture is named "Logo" and saved in "C:" ,. Everything is going well except that the picture is not inserted in the target cell "C33"and always inserted in the same false cell. This is the code I'm using:
VBA Code:
Private Sub cmddisplaylogo_Click()
Dim ws As Worksheet
Set ws = Worksheets("SETTINGS")
Dim ws1 As Worksheet
Set ws1 = Worksheets("Rx")
Application.ScreenUpdating = False
Dim logoname As String, T As String
myDir = "C:\"
logoname = ws1.Range("AH1")
T = ".jpg"
ws1.Range("C33").Value = logoname
On Error GoTo Errormessage:
ActiveSheet.Shapes.AddPicture Filename:=myDir & logoname & T, Linktofile:=msoFalse, savewithdocument:=msoTrue, Left:=100, Top:=5, Width:=100, Height:=60
Errormessage:
If Err.Number = 1004 Then
MsgBox "File does not exist."
End If
Application.ScreenUpdating = True
End Sub
I have had a look around and confused myself! Any help gratefully received!
Many thanks and stay safe
Karim