I am working on a macro to insert an electronic signature based on the password that the user inputs. I use the vlookup function to match the password to the image location. However, I am haing trouble getting the image to show up in the document. my vba code is below:
with this code i keep recieving the error: 1004 Unable to get the insert property of the picture class.
vb
Option Explicit
Private Sub cmdSignature1_Click()
Dim strPassword As String
Dim rngSigloc As Range
Dim varLocation As Variant
Dim rngSig1 As Range
Dim rngpassword As Range
Dim pfind As Range
Set rngSig1 = Range("signature1")
Set rngSigloc = Range("PasswordFind")
Set rngpassword = Range("a1")
Set pfind = Range("passwordfind")
strPassword = InputBox("Please enter your password")
Sheets("signature").Select
Range("A1").Select
ActiveCell.Value2 = strPassword
varLocation = Application.WorksheetFunction.VLookup(rngpassword, pfind, 2, False)
Debug.Print varLocation
Sheets("101 IR FORM").Select
rngSig1 = ActiveSheet.Pictures.Insert(varLocation).Select
Selection.ShapeRange.ScaleHeight 0.25, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 0.4, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.IncrementLeft 159#
Selection.ShapeRange.IncrementTop 2#
end sub
vb
Any help or suggestions would be greatly appreciated.
with this code i keep recieving the error: 1004 Unable to get the insert property of the picture class.
vb
Option Explicit
Private Sub cmdSignature1_Click()
Dim strPassword As String
Dim rngSigloc As Range
Dim varLocation As Variant
Dim rngSig1 As Range
Dim rngpassword As Range
Dim pfind As Range
Set rngSig1 = Range("signature1")
Set rngSigloc = Range("PasswordFind")
Set rngpassword = Range("a1")
Set pfind = Range("passwordfind")
strPassword = InputBox("Please enter your password")
Sheets("signature").Select
Range("A1").Select
ActiveCell.Value2 = strPassword
varLocation = Application.WorksheetFunction.VLookup(rngpassword, pfind, 2, False)
Debug.Print varLocation
Sheets("101 IR FORM").Select
rngSig1 = ActiveSheet.Pictures.Insert(varLocation).Select
Selection.ShapeRange.ScaleHeight 0.25, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 0.4, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.IncrementLeft 159#
Selection.ShapeRange.IncrementTop 2#
end sub
vb
Any help or suggestions would be greatly appreciated.