#AutoIt3Wrapper_run_debug_mode=Y ;Y/N use this to debug in console window <--- LOOK #include #include #include #include #include $version = "v1d" ;v1d - bare bones $oWord = _Word_Create() ;Create application object $testfile = "\Test for WordRangeTesting v1c.docx" $oDoc = _Word_DocOpen($oWord, @ScriptDir & $testfile, Default, Default, True) ;put test file in same directory as script If @error Then Exit MsgBox($MB_SYSTEMMODAL, "ERROR", "Error opening file = '" & @ScriptDir & $testfile & "'" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;--- TEST 3 - show where I don't understand what's going on $oRange1 = _Word_DocFind($oDoc, "003", 0, Default, True) ;search entire doc from start and move toward end of document $oTemp = $oRange1 ;okay so here's the problem ************ ;let's extend $oTemp as we want to leave $oRange1 as it was. $oTempExtended = _Word_DocRangeSet($oDoc, $oTemp, $wdCharacter, 0, $wdParagraph, 1) ;extend range to and including paragraph character - TRYING to leave $$oRange1 alone ;note $oTemp and $oTempExtended both extended ;showing $oTempExtended extended as it should $oTempExtended.Bold = False ;debug MsgBox($MB_SYSTEMMODAL, "DEBUG TEST 3", "$oTempExtended.Bold = False") $oTempExtended.Bold = True ;so we can see it MsgBox($MB_SYSTEMMODAL, "DEBUG TEST 3", "$oTempExtended.Bold = True") $oTempExtended.Bold = False ;debug MsgBox($MB_SYSTEMMODAL, "DEBUG TEST 3", "$oTempExtended.Bold = False") ;checking $oRange1 which should NOT be extended $oRange1.Bold = False ;debug MsgBox($MB_SYSTEMMODAL, "DEBUG TEST 3", "should be 003 only $oRange1.Bold = False") $oRange1.Bold = True ;so we can see it MsgBox($MB_SYSTEMMODAL, "DEBUG TEST 3", "should be 003 only $oRange1.Bold = True" & @CRLF& "Why is it extended? $oRange1 was defined as 003 and only $oTemp was extended.") $oRange1.Bold = False ;debug MsgBox($MB_SYSTEMMODAL, "DEBUG TEST 3", "should be 003 only $oRange1.Bold = False") ;*********** DANG IT - THE ORIGINAL RANGE ***HAS*** BEEN EXTENDED - *** clearly I don't understand what's going on. *** ;perhaps the assignment is really a namespace pool and they all point to the same structure like aliases Exit