cursor won't move to selection

C

carlosremelios

My code is below. It works fine, moving from textframe to textframe
and asks the user about making changes to the text in the textframe
BUT the cursor and or screen doesn't move to the next location, it
just stays on page one. Screen update, maybe?

Sub fixTextBoxes()

Dim s As Shape
For Each s In ActiveDocument.Shapes
With s.TextFrame
If .HasText Then s.Select
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to Remove strikethrough and change font
color to black?" ' Define message.
Style = vbYesNoCancel + vbCritical + vbDefaultButton2 '
Define buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes
Selection.Font.Color = wdColorBlack
Selection.Font.StrikeThrough = False

If Response = vbCancel Then Exit Sub
Else ' User chose No.
MyString = "No" ' Perform some action.
End If
End With
Next
End Sub
 
J

Jay Freedman

After the box is selected, try
ActiveWindow.ScrollIntoView Selection.Range

I'm not sure how that will work with a textframe, but it's worth a try.

Something you didn't ask, but since you posted your code... If .HasText is
false, you probably want to skip the rest of the code down to the End With
statement.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
C

carlosremelios

After the box is selected, try
ActiveWindow.ScrollIntoView Selection.Range

I'm not sure how that will work with a textframe, but it's worth a try.

Something you didn't ask, but since you posted your code... If .HasText is
false, you probably want to skip the rest of the code down to the End With
statement.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.








- Show quoted text -

Voila! Thank You! It works perfectly. Yes, I will clean up the
other funtioning, I didn't do that yet, because the basic functioning
wasn't working. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top