VBA Help with naming object

keith_shoaf

New Member
Joined
Oct 8, 2014
Messages
39
Hello everyone! I am trying to get a signature line added to my excel workbook using VBA. I can get the signature line inserted to the worksheet I want using the following:

ActiveWorkbook.Signatures.AddSignatureLine "{00000000-0000-0000-0000-000000000000}"

But then I need to move it to get the signature block in the correct position. But to do that, I need to be able to call it by name. But I cannot figure out how to name it. I know it is given a default name (“Picture X”). But of course that changes each time you add a signature line. Is there a way to name the “picture” when creating or even just capture the name when it is added so that I can select it to move its position? Or is there a way to position it when adding?

Thanks in advance for any assistance you can provide.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
This should hopefully get you going...worked for me.
Code:
Sub TestSig()
    Dim objSig As Signature
    Dim shp As Shape
    
    Set objSig = ActiveWorkbook.Signatures.AddSignatureLine("{00000000-0000-0000-0000-000000000000}")
    
    Set shp = objSig.SignatureLineShape
    shp.Left = shp.Parent.Range("B5").Left
    shp.Top = shp.Parent.Range("B5").Top
        
    Set objSig = Nothing
    Set shp = Nothing

End Sub
Have fun!
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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