Closed Thread
Results 1 to 4 of 4

VBA: Getting signature data from signed and unsigned signature blocks

Hybrid View

  1. #1
    Registered User
    Join Date
    09-09-2015
    Location
    Gloucestershire, England
    MS-Off Ver
    Microsoft Word 2013
    Posts
    1

    VBA: Getting signature data from signed and unsigned signature blocks

    I am using Microsoft Office 2013.

    I have a number of Excel and Word documents all of which contain a number of signature blocks.
    I want to be see which signature blocks have been signed and which ones have not been signed.
    My problem is that in the simplified VBA code below Signatures.Count only returns the number of SIGNED blocks.
    How do I get data from both signed and unsigned signature blocks.

    Sub getsigdata()

    Dim signer As String

    countsigs = ActiveDocument.Signatures.Count

    If countsigs > 0 Then
    For i = 1 To countsigs

    signer = ActiveDocument.Signatures.Item(i).Setup.SuggestedSigner
    MsgBox (signer)
    Next i

    End If

    End Sub

  2. #2
    Registered User
    Join Date
    09-20-2019
    Location
    Montreal, Canada
    MS-Off Ver
    2016 MSO (160.4639.1000) 32 bits
    Posts
    1

    Re: VBA: Getting signature data from signed and unsigned signature blocks

    You've probably found the answer by now but this is for people like me
    …
    
        Dim wb As Workbook
        
        Dim sig_nb As Long ' number of signature in document
        Dim sig_signed As Long ' number of signed signature in document
        Dim sig_unsigned As Long ' number of unsigned signature in document
        
        Set wb = ThisWorkbook
        
        wb.Signatures.Subset = msoSignatureSubsetSignatureLines
        
        sig_nb = wb.Signatures.Count
        
        wb.Signatures.Subset = msoSignatureSubsetSignatureLinesSigned
        
        sig_signed = wb.Signatures.Count
        
        wb.Signatures.Subset = msoSignatureSubsetSignatureLinesUnsigned
        sig_unsigned = wb.Signatures.Count
        
        If sig_nb = 0 Then
            MsgBox "Workbook has no signature", vbOKOnly
        Else
            MsgBox "Workbook has " & sig_nb & "signature", vbOKOnly
        End If
    
        If sig_signed = 0 Then
            MsgBox "Workbook has no signed signature", vbOKOnly
        Else
            MsgBox "Workbook has " & sig_signed & " signed signature", vbOKOnly
        End If
    
        If sig_unsigned = 0 Then
            MsgBox "Workbook has no unsigned signature", vbOKOnly
        Else
            MsgBox "Workbook has " & sig_unsigned & " unsigned signature", vbOKOnly
        End If

  3. #3
    Registered User
    Join Date
    02-04-2022
    Location
    Germany
    MS-Off Ver
    365
    Posts
    4

    Re: VBA: Getting signature data from signed and unsigned signature blocks

    This Thread is old, but i have the exact same problem/question.
    The answer did not work for me.
    I get signatures only when i use subset = 0 (msoSignatureSubsetSignaturesAllSigs).

    Maybe someone knows my mistake:

      Dim oobjWDApp As Object 'Word.Application
      Dim oobjDoc As Object  'Word.Document
      Dim owdRange As Object ' Word.Range
    
    Set oobjWDApp = CreateObject("Word.Application")
    oobjWDApp.Visible = False
    Set oobjDoc = oobjWDApp.Documents.Open(strQuellDat, ReadOnly:=True)
    
    oobjDoc.Signatures.Subset = 0
    Debug.Print "0 -> " & oobjDoc.Signatures.Count
    oobjDoc.Signatures.Subset = 1
    Debug.Print "1 -> " & oobjDoc.Signatures.Count
    oobjDoc.Signatures.Subset = 2
    Debug.Print "2 -> " & oobjDoc.Signatures.Count
    oobjDoc.Signatures.Subset = 3
    Debug.Print "3 -> " & oobjDoc.Signatures.Count
    oobjDoc.Signatures.Subset = 4
    Debug.Print "4 -> " & oobjDoc.Signatures.Count
    oobjDoc.Signatures.Subset = 5
    Debug.Print "5 -> " & oobjDoc.Signatures.Count
    oobjDoc.Signatures.Subset = 6
    Debug.Print "6 -> " & oobjDoc.Signatures.Count
    Output looks like this:
    0 -> 5
    1 -> 0
    2 -> 0
    3 -> 0
    4 -> 0
    5 -> 0
    6 -> 5
    The docx File has 9 Signaturelines, 5 signed, 4 not.
    Thanks in advance
    Last edited by LeeHannah; 02-04-2022 at 06:04 AM.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,379

    Re: VBA: Getting signature data from signed and unsigned signature blocks

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 04-15-2015, 09:34 PM
  2. add excel data in body email (data range is dynamic) & signature issue
    By Marijke in forum Outlook Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2014, 05:41 AM
  3. Replies: 0
    Last Post: 04-04-2013, 07:18 AM
  4. Macro to fill in signature and date blocks
    By Hambone70 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2013, 11:09 AM
  5. Multiple signature or signature areas on a form
    By dstocker in forum Excel General
    Replies: 0
    Last Post: 05-25-2012, 05:08 PM
  6. Help with Signed vs Unsigned Macros
    By swieduwi in forum Excel General
    Replies: 0
    Last Post: 04-27-2005, 09:48 AM
  7. How do I add a signature
    By Penfold in forum Excel General
    Replies: 1
    Last Post: 02-14-2005, 04:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1