QuarkXPress error code -1700

Hello,
Having an issue with error code -1700 halting my script. Quark is saying it can’t make some data into the expected type. I pasted the script that I have. Any input would be most appreciated. Cheers, James.
tell application “QuarkXPress”
activate

--error checking
set checkVolumes to (list disks)
if checkVolumes does not contain "Customer" then
	beep
	display dialog "Customer volume must be mounted." buttons {"Cancel"} with icon 0 default button 1
	return
end if



set textPath to {"Public:Customer Artwork:CUST LIBRARY:ENVTXT"}
set statList to {"A- BrushScript", "B- FranklinGothic", "C- Souvenir", "D- UniversityRoman", "E- Helvetica", "F- KauflinKoffee", "G- Optimum", "H- CopperPlate"}
set stockList to {"CopperPlate", "Helvetica", "NewBaskerville"}
set stationeryStyles to statList
set stockStyles to stockList
set styleChoice to textPath

tell application "QuarkXPress"
	if (exists document 1) is true then
		set errorTrap to "flow"
		version of document 1
		if errorTrap is not 10 then
			beep
			display dialog "Document needs to be reflowed first." buttons {"Reflow"}
			set docPath to file path of document 1
			save document 1 in docPath version 80
			close document 1 saving no
			open file docPath use doc prefs yes remap fonts no with reflow
			save document 1
			
			
			
			
		end if
		delay 5
		tell application "QuarkXPress"
			
			
			display dialog "Enter Customer Number" with default answer
			set custNumber to text returned of result
			set custBug to custNumber
			
			
			tell application "QuarkXPress"
				
				
			end tell
			set targetBox to {every story of every text box}
			if "errNum" = -1728 then
				beep
				display dialog "No text box selected" buttons {"Cancel"} with icon 0 default button 1
				return
				
			end if
			
		end tell
		
		
		tell application "QuarkXPress"
			
			set boxName to targetBox
			
			
			try
				set boxName to name of targetBox
				if boxName does not contain "ADDR" then
					beep
					display dialog "Selected text box is not an envelope." buttons {"Cancel"} with icon 0 default button 1
					return
					set addrtype to word 2 of boxName
					set custBug to word 1 of story 1 of (every text box whose name is "ENVBUG") of page 1 of document 1
					set targetBug to object reference of (every text box whose name is "ENVBUG") of page targetPage of document 1
					if custBug is "EN0000" then
						set custNumber to ""
					else
						set custNumber to characters 3 through {count of text items of custBug} of custBug as text
					end if
				end if
				return
			end try
		end tell
		
		
		beep
		display dialog " Stationery or Stock Styles?" buttons {"Stationery", "Stock"} default button 1
		if "Stationery" then
			beep
			display dialog "Really use Stationery?" & return with icon 2
			set stationeryStyles to item 1 of (choose from list statList with prompt "Stationery " with allowed without multiple selections allowed)
			set autoDelete to true
			
		else
			set stockStyles to item 1 of (choose from list stockList with prompt "Stock " with allowed without multiple selections allowed)
			
		end if
		set autoDelete to false
		
		
		
	end if
	
	
	
	
	--format page
	set importStyles to true
	set textFormat to styleChoice as text
	set targetBox to textPath
	set word1 of targetBug to custBug
	set story1 of targetBox to {selection of styleChoice}
	
	
end tell

end tell

How far do you get until the error happens? After what line? Because I don’t have Quark but would try to read what’s going on.

Hi Super, the error occurs at the point when the docPath tries to open after Quark closes document 1

tell application “QuarkXPress”
if (exists document 1) is true then
set errorTrap to “flow”
version of document 1
if errorTrap is not 10 then
beep
display dialog “Document needs to be reflowed first.” buttons {“Reflow”}
set docPath to file path of document 1
save document 1 in docPath version 80
close document 1 saving no
open file docPath use doc prefs yes remap fonts no with reflow
save document 1

Hopefully you can lend a hand on this one. Much hair pulling over it.

                                                                                Cheers, James!

Try removing the word file:

open docPath use doc prefs yes remap fonts no with reflow

Hello Shane,
I modified the script via your suggestion. The template still goes back to its original path but the copy does not open. Any other suggestions? I will check out the links you provided. Thanks, James.