Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2017, 03:00 PM
ilcaa72 ilcaa72 is offline On .Select, Errors: Cant Execute in Break Mode Windows 7 64bit On .Select, Errors: Cant Execute in Break Mode Office 2013
Novice
On .Select, Errors: Cant Execute in Break Mode
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default On .Select, Errors: Cant Execute in Break Mode

here is the code, i am using Step through in the debugger, when i get to .Select it says, "Cant Execute in Break Mode" . it actually stills selects the sentence and I can continue but still displays this error msg. I would like to select the sentence, to visually track the changes.



Anyway to fix this issue? thanks

Code:
If do_DocVars_Exist = 1 Then
    sentNumb = ActiveDocument.Variables("selNumb").Value
    Set prevSent = doc.Sentences(sentNumb)

    With prevSent
        .Select
        .Font.Size = ActiveDocument.Variables("selSize").Value
        .Font.Color = ActiveDocument.Variables("selColor").Value
        .Font.Name = ActiveDocument.Variables("selName").Value
    End With
End If
Reply With Quote
  #2  
Old 04-28-2017, 11:06 PM
gmayor's Avatar
gmayor gmayor is offline On .Select, Errors: Cant Execute in Break Mode Windows 10 On .Select, Errors: Cant Execute in Break Mode Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Without the rest of the code, anyone trying to assist is flying blind. I think I understand the concept of what the macro is doing and the following will do that provided the values in the variables are appropriate:

Code:
Option Explicit

Sub Macro1()
Dim prevSent As Range
Dim sentNumb As Long
    If do_DocVars_Exist = True Then
        sentNumb = ActiveDocument.Variables("selNumb").Value
        If ActiveDocument.Sentences.Count >= sentNumb Then
            Set prevSent = ActiveDocument.Sentences(sentNumb)
            With prevSent
                .Select
                .Font.Size = ActiveDocument.Variables("selSize").Value
                .Font.Color = ActiveDocument.Variables("selColor").Value
                .Font.Name = ActiveDocument.Variables("selName").Value
            End With
        Else
            MsgBox "There is no sentence number " & sentNumb
        End If
    Else
        MsgBox "The required variables are not present"
    End If
End Sub

Function do_DocVars_Exist() As Boolean
Dim oVar As Variable
Dim iVar As Integer: iVar = 0

    For Each oVar In ActiveDocument.Variables
        Select Case oVar.Name
            Case "selNumb", "selSize", "selColor"
                If IsNumeric(oVar.Value) Then
                    iVar = iVar + 1
                End If
            Case "selName"
                iVar = iVar + 1
        End Select
    Next oVar
    If iVar = 4 Then do_DocVars_Exist = True
End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 04-29-2017, 05:08 AM
ilcaa72 ilcaa72 is offline On .Select, Errors: Cant Execute in Break Mode Windows 7 64bit On .Select, Errors: Cant Execute in Break Mode Office 2013
Novice
On .Select, Errors: Cant Execute in Break Mode
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default

the gmayor

but the only question i had was why does the display a msgbox saying "Cannot Execute in Break Mode" once it executes the line with .Select

the code continues with no problems (meaning there really is not effect to "Cannot execute in Break Mode")

it almost seems like a bug to me. why wouldnt i be able to .Select a sentence? Why would it display this message? why would the code be able to continue without any issues and still .Select the sentence...

thks for the reply
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are Portrait mode JPG Images changed to landscape mode KHH0725 PowerPoint 0 02-22-2017 01:51 PM
Microsoft Office Word Online Text Space is Different in Reading Mode from When it's in Editing Mode darkjanggo Word 1 12-15-2015 05:06 PM
On .Select, Errors: Cant Execute in Break Mode Can you set -break on all errors in code moggymiaow Word VBA 4 10-10-2013 04:01 PM
paragaph hard break, soft break and ...strange break czomberzdaniela Word 2 12-03-2010 06:58 PM
On .Select, Errors: Cant Execute in Break Mode Word won't come back to normal mode from proofreading mode prg4hire Word 2 09-25-2010 09:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft