Using Windows 7, Excel 2013 I'm very new to VBA and have spent hours trying different solutions from other questions.
Here is the code I am currently using to insert my digital signature into an excel document used as a form.
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 208.3333070866, 659.1666929134, _
243.3333858268, 38.3333070866).Select
Selection.ShapeRange.ScaleWidth 1.0787668906, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.0217405147, msoFalse, _
msoScaleFromBottomRight
Selection.ShapeRange.Line.Visible = msoFalse
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture "C:\Users\msporney\Documents\Signature.jpg"
.TextureTile = msoFalse
.RotateWithObject = msoTrue
My problem: The code works fine when I'm working I share this workbook with other users. We all have the same file "signature.jpg" in our documents folder, but this code is only referring to my machine (msporney). I need a relative reference to the file location (C:\users\anybody).
I've tried:
.UserPicture "C:\users\\Documents\Signature.jpg"
.UserPicture "C:\users\.\Documents\Signature.jpg"
.UserPicture "C:\users\\Documents\Signature.jpg"
.UserPicture "\..\Documents\Signature.jpg"
I always get the same error: Run-time error '-2147024893 (800700003)': Method "UserPicture' of object "FillFormat' failed