H
HONYAKUKA
I don't know exactly what's causing this, so I can only give an example.
I have a macro that I use to make global changes in a document, such as
converting straight to curly quote marks.
When I have Tools > Options > Windows in Taskbar unchecked, such that all the
Word document icons in the Taskbar are merged into one icon, running this macro
causes the screen to switch to another Word document. Specifically, if multiple
documents are open, this macro will cause the last document listed in the
Windows menu to come forward. (If I run the macro in this document, it stays
forward --- doesn't switch to another document.)
The title bar(?) at the very top of the window will appear in color such that
the document that comes forward looks like it is in focus, but the document
will not really be in focus. I.e., I have to move the mouse/cursor inside the
document to select something to bring it in focus. Otherwise, I can't type in
the document.
This did not happen with Word 2000 and the WordInTaskbar.dot Add-In installed.
(By the way, I have removed this, so the problem is not interference from a
now-redundant Add-In.) Also, it doesn't happen in Word 2003 when Windows In
Taskbar is checked.
For reference, the macro code is as follows. The switching of windows occurs
when the .Execute Replace line runs. (The same problem occurs if I write the
macros as one macro rather than as one macro calling another.)
*******************
Sub FixApostrophesAndQuoteMarks()
Call FindReplaceTextOnceThru("'", "'")
Call FindReplaceTextOnceThru("""", """")
End Sub
Sub FindReplaceTextOnceThru(xFind$, xReplace$)
Select Case Selection.Type
Case wdSelectionIP 'Assume entire document should be changed.
With Selection.Find
.MatchSoundsLike = False
.MatchWildcards = False
.MatchWholeWord = False
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll, FindText:=xFind,
ReplaceWith:=xReplace
End With
Case wdSelectionNormal, wdSelectionColumn, wdSelectionRow
With Selection.Find
.MatchSoundsLike = False
.MatchWildcards = False
.MatchWholeWord = False
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Execute Replace:=wdReplaceAll, FindText:=xFind,
ReplaceWith:=xReplace
End With
Case Else
'Do nothing (discontinue macro).
End Select
End Sub
************************
Thanks for any assistance.
Jay
I have a macro that I use to make global changes in a document, such as
converting straight to curly quote marks.
When I have Tools > Options > Windows in Taskbar unchecked, such that all the
Word document icons in the Taskbar are merged into one icon, running this macro
causes the screen to switch to another Word document. Specifically, if multiple
documents are open, this macro will cause the last document listed in the
Windows menu to come forward. (If I run the macro in this document, it stays
forward --- doesn't switch to another document.)
The title bar(?) at the very top of the window will appear in color such that
the document that comes forward looks like it is in focus, but the document
will not really be in focus. I.e., I have to move the mouse/cursor inside the
document to select something to bring it in focus. Otherwise, I can't type in
the document.
This did not happen with Word 2000 and the WordInTaskbar.dot Add-In installed.
(By the way, I have removed this, so the problem is not interference from a
now-redundant Add-In.) Also, it doesn't happen in Word 2003 when Windows In
Taskbar is checked.
For reference, the macro code is as follows. The switching of windows occurs
when the .Execute Replace line runs. (The same problem occurs if I write the
macros as one macro rather than as one macro calling another.)
*******************
Sub FixApostrophesAndQuoteMarks()
Call FindReplaceTextOnceThru("'", "'")
Call FindReplaceTextOnceThru("""", """")
End Sub
Sub FindReplaceTextOnceThru(xFind$, xReplace$)
Select Case Selection.Type
Case wdSelectionIP 'Assume entire document should be changed.
With Selection.Find
.MatchSoundsLike = False
.MatchWildcards = False
.MatchWholeWord = False
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll, FindText:=xFind,
ReplaceWith:=xReplace
End With
Case wdSelectionNormal, wdSelectionColumn, wdSelectionRow
With Selection.Find
.MatchSoundsLike = False
.MatchWildcards = False
.MatchWholeWord = False
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Execute Replace:=wdReplaceAll, FindText:=xFind,
ReplaceWith:=xReplace
End With
Case Else
'Do nothing (discontinue macro).
End Select
End Sub
************************
Thanks for any assistance.
Jay