Share via

I am getting 5941 RT Error code...but why?

Anthony Abner 1 Reputation point
2021-06-17T07:48:40.167+00:00

Here is my VB code:

 Dim artistName As Range
    Set artistName = ActiveDocument.Bookmarks("artistName").Range
    artistName.Text = Me.TextBox1.Value
    Dim artistAddress As Range
    Set artistAddress = ActiveDocument.Bookmarks("artistAddress").Range
    artistAddress.Text = Me.TextBox4.Value
    Dim recordingFund As Range
    Set recordingFund = ActiveDocument.Bookmarks("recordingFund").Range
    recordingFund.Text = Me.TextBox2.Value
    Dim marketingBudget As Range
    Set marketingBudget = ActiveDocument.Bookmarks("marketingBudget").Range
    marketingBudget.Text = Me.TextBox3.Value
    Dim revShare As Range
    Set revShare = ActiveDocument.Bookmarks("revShare").Range
    revShare.Text = Me.TextBox5.Value
    Dim rightsPeriod As Range
    Set rightsPeriod = ActiveDocument.Bookmarks("rightsPeriod").Range
    rightsPeriod.Text = Me.TextBox6.Value
    Dim territory As Range
    Set territory = ActiveDocument.Bookmarks("territory").Range
    territory.Text = Me.TextBox7.Value
    Me.Repaint
    Dim strDocName As String
    Dim intPos As Integer

    ' Find position of extension in file name
    strDocName = ""
    intPos = InStrRev(strDocName, ".")

    If intPos = 0 Then

        ' If the document has not yet been saved
        ' Ask the user to provide a file name
        strDocName = InputBox("Please enter the name " & _
            "of your document.")
    Else

        ' Strip off extension and add ".txt" extension
        strDocName = Left(strDocName, intPos - 1)
        strDocName = strDocName & ".docx"
    End If

    ' Save file with new extension
    ActiveDocument.SaveAs2 FileName:=strDocName, _
        FileFormat:=wdFormatDocumentDefault
    stInfo.Hide
    infoForm.Show

End Sub
Developer technologies | Visual Basic for Applications

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.