missing values in Microsoft Word ranges.

I’m writing a routine to transfer information from a Microsoft Word file to FileMaker Pro Advanced. I’m having a problem understand why I’m getting a set of missing text object information when the routine travels in one direction of an “if” compared to another.
When ciNum = 2, the copyMWParagraph routine is skipped, and deleteMWparagraph and moveMWselToPrevparagraph routines work as expected. When ciNum = 5, the copyMWParagraph routine correctly copies a line of text to the clipboard, which is then successfully pasted into a field in FileMaker. But the deleteMWparagraph routine then fails to delete the line in Word because the variables m and n come back as missing values. I’ve written some delay code around the lines that assigns m and n to see if Word is just in the middle of processing or something, but this hasn’t helped. Interestingly, I am able to get the actual text content by adding a line to do so before assigning m. But it still can’t seem to find the start of content. Anyone have any ideas about what’s going on?


                -- .
                -- .
                -- .
		tell application "Microsoft Word"
			activate
                        -- Gets some basic information about a text line in Word here
                        -- ciNum is calculated based on the color index of the text
		end tell -- application "Microsoft Word"
		
		if ciNum = 2 or ciNum = 5 then
			ifColorIndexIs2(paraText)  -- This analyzes the text line and fills the fields in the FileMaker file
			if ciNum = 5 then
				copyMWParagraph(paraNum, docName)
				delay 1
				tell application "FileMaker Pro Advanced"
					activate
                                        -- this pastes the line copied from Word into a FileMaker file field
				end tell -- application "FileMaker"
			end if -- ciNum = 5
			delay 0.2
			deleteMWparagraph(paraNum, docName)
			delay 0.2
			moveMWselToPrevparagraph(paraNum, docName)
		end if -- ciNum = 2 or
                -- .
                -- .
                -- .

to deleteMWparagraph(paraNum, docName)
	-- P0498v1.00
	-- Independent
	
	-- Deletes a paragraph by paragraph number in document docName.
	-- Returns the position of the selection after the deleted text.
	
	tell application "Microsoft Word"
		activate
		set m to start of content of text object of paragraph paraNum of document docName
		set n to end of content of text object of paragraph paraNum of document docName
		set range1 to create range active document start m end n
		select range1
		set content of range1 to ""
		set selPos to selection start of selection
	end tell -- application "Microsoft Word"
	return {m, n, paraNum, paraText}
end deleteMWparagraph

to moveMWselToPrevparagraph(paraNum, docName)
	-- P0499v1.00
	-- Independent
	
	-- Returns the position of the selection after moving the selection mark.
	
	tell application "Microsoft Word"
		set paraText to content of text object of paragraph paraNum of document docName
		set m to start of content of text object of paragraph paraNum of document docName
		set m to m - 1
		set range1 to create range active document start m end m
		select range1
	end tell -- application "Microsoft Word"
	return m
end moveMWselToPrevparagraph

to copyMWParagraph(paraNum, docName)
	-- P0500v1.00
	-- Independent
	
	-- Copies the paragraph the selection is in.
	
	tell application "Microsoft Word"
		set m to start of content of text object of paragraph paraNum of document docName
		set n to end of content of text object of paragraph paraNum of document docName
		set range1 to create range active document start m end n
		select range1
		copy object range1
	end tell -- application "Microsoft Word"
	return {m, n}
end copyMWParagraph

Model: MacBook
AppleScript: 2.1.2
Browser: Safari 525.22
Operating System: Mac OS X (10.4)

Ok, so for anyone that is curious, I isolated the offending line of code in the “if ciNum = 5” block down to the activate statement in the FileMaker block within. This was strange since I had a similar FileMaker block within the ifColorIndexIs2 routine that was called just before the “if ciNum = 5” block and that wasn’t causing any problems. So I stuck all the code inside the “if ciNum = 5” block into it’s own subroutine and success, it works now. I still don’t know what caused the problem. Why does alternating tell blocks between FileMaker and Word cause Word to loose track of it’s data??? Any of you guru’s have any ideas?