  // ----------------------------------------------------
  // User name (OS): Phil
  // Date and time: 01/18/10, 09:02:47
  // ----------------------------------------------------
  // Method: FRSendHTMLFile
  // Description
  // 
  //
  // Parameters
  // ----------------------------------------------------

  //$1=Path to html file
  //{$2...$16} = Optional text parameters to be passed into the footrunner

C_TEXT($1;${2};$ttText;$ttHTML;$ttFRCode;FRHTML;$ttExecute;$ttLine)
C_TIME($rDoc)
C_LONGINT($xlPos;$xlPos2;$xlStart)
C_LONGINT($0;xl_FR_Return)

$ttHTML:=""
xl_FR_Return:=0
If (Test path name($1)=Is a document )
$rDoc:=Open document($1;"";Read Mode )
If (OK=1)
RECEIVE PACKET($rDoc;$ttText;MAXTEXTLENBEFOREV11 )
SET TEXT TO PASTEBOARD($ttText)
CLOSE DOCUMENT($rDoc)
Repeat 
$xlPos:=Position("<!--FRCODE";$ttText)
If ($xlPos>0)
$ttHTML:=$ttHTML+Substring($ttText;1;$xlPos-1)
$ttText:=Substring($ttText;$xlPos+10)

$xlPos2:=Position("-->";$ttText)  // find end of code
If ($xlPos2>0)
$ttFRCode:=Substring($ttText;1;$xlPos2-1)
$ttText:=Substring($ttText;$xlPos2+3)
FRHTML:=""

$ttExecute:="xl_FR_Return:=FRRunTextRaw($ttFRCode;0"
For ($i;2;Count parameters)
$ttExecute:=$ttExecute+";$"+String($i)
End for 
$ttExecute:=$ttExecute+")"
EXECUTE FORMULA($ttExecute)

$ttHTML:=$ttHTML+FRHTML
End if 
Else 
$ttHTML:=$ttHTML+$ttText
End if 
Until ($xlPos=0)

SEND HTML TEXT($ttHTML)
Else 
xl_FR_Return:=-43
End if 
Else 
xl_FR_Return:=-43
End if 
$0:=xl_FR_Return
