Results 1 to 17 of 17

Thread: Run Time Error 5844

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Mentor
    Joined
    Aug 2020
    Location
    Hampshire
    Posts
    403
    Location

    Run Time Error 5844

    I've occasionally been getting this error when running a macro enabled template.

    Error.jpg

    It doesn't happen every time, but when it does, it occurs on this line of code as shown in bold.

    For Each oCC In ActiveDocument.ContentControls
        Set oRng = oCC.Range
        Select Case oCC.Title
            Case "One"
                oRng.Text = .TextBox1.Text
            Case "Two"
                oRng.Text = .TextBox2.Text
            Case "Three"
                oRng.Text = .ComboBox1.Value
                oRng.Font.Color = .ComboBox1.BackColor
            Case "Four"
                oRng.Text = .TextBox4.Text
    .......
    The only thing that I can add that might help in solving this issue, is that text is pasted into TextBox4, after being copied from another bespoke source, prior to pressing the proverbial "Enter" button to commit the TextBox / ComboBox entries to the word document.

    The only thing that I have found online seems to reference carriage returns which might have something to do with this?
    https://social.msdn.microsoft.com/Forums/en-US/a6e801ca-2d12-4a66-8df4-734f15cf4333/linebreak-in-contentcontrol?forum=innovateonoffice

    Unfortunately I cannot provide any copy examples of the text that is causing the issue because this was work based.

    I don't know if there is something codewise that can be done to alleviate the error?

    Many thanks!
    Steve
    Last edited by Aussiebear; 12-24-2024 at 02:15 AM.

Posting Permissions

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