0
votes

I am SUPER new to VBA and I am trying to write a email signature generator.

working in word o365 Getting error when running: Compile error: Expected End Sub

Opening the document getting error: Runtime error 424 Object required

ThisDocument:

Private Sub Document_New()
    stInfo.Show
End Sub

Signature:

Private Sub Submit_Click()

Private Sub CommandButton2_Click()
End Sub

Private Sub cancelBut_Click()
    stinfo.Hide
End Sub

Private Sub Label2_Click()
End Sub

Private Sub OKbut_Click()
    Dim Name As Range
    Set Name = ActiveDocument.Bookmarks("Name").Range
    Name.Text = Me.Name.Value
    Dim JobTitle As Range
    Set JobTitle = ActiveDocument.Bookmarks("JobTitle").Range
    JobTitle.Text = Me.Title.Value
    Dim DirectPhone As Range
    Set DirectPhone = ActiveDocument.Bookmarks("DirectPhone").Range
    DirectPhone.Text = Me.DirectPhone.Value
    Dim CellPhone As Range
    Set CellPhone = ActiveDocument.Bookmarks("CellPhone").Range
    CellPhone.Text = Me.CellPhone.Value
    Dim Email As Range
    Set Email = ActiveDocument.Bookmarks("Email").Range
    Email.Text = Me.Email.Value
    Dim Address As Range
    Set Address = ActiveDocument.Bookmarks("Address").Range
    Address.Text = Me.Address.Value
    Me.Repaint
    ' Find position of extension in file name
    strDocName = ""
    intPos = InStrRev(strDocName, ".")

    stinfo.Hide
    infoForm.Show
    
End Sub
1
Submit_Click() is missing the closing End Sub statement. Is this a typo?Kostas K.

1 Answers

0
votes

As noted by Kostas K. and the error message, you need an End Sub command.

Private Sub Submit_Click()
End Sub