Do you need Word and Excel constants?
Posted: Sun Jul 16, 2006 3:49 am
1) Go to: http://msdn.microsoft.com/library/defau ... 049731.asp
2) Right click on web-page. Save web-page source code as a txt file, example Word2003.txt
3) Run application. Select txt file in step 2 and choose a ch file name, example, Word2003.ch
4) Look up in the left panel for Excel 2003 constants or go to:
http://msdn.microsoft.com/library/en-us ... 049962.asp
and repeat steps 2-3
Reading MS Constants app souce code:
// identation eaten by message editor
#include "Fivewin.ch"
//===========================================
Function MsOfficeVars()
Local cSource, cDest, cText
Local k
Local cs00:="<h1>", cs01:="</h1>"
Local cs10:=["bterm">], cs11:="</b>"
Local cs20:="<tr><td>", cs21:="</td><td>", cs22:="</td></tr>"
Local hOut
Local cc, c1, c2
IF Empty(cSource:=cGetFile("txt file|*.txt","Source file"))
return nil
ENDIF
IF Empty(cDest:=cGetFile("ch file|*.ch","Destination file"))
return nil
ENDIF
IF File(cDest) .and. !MsgNoYes("File "+cDest+" exists"+CRLF+"Overwrite it?")
return nil
ENDIF
cText:=MemoRead(cSource)
k:=At(cs00,cText); cText:=SubStr(cText,k+Len(cs00))
k:=At(cs01,cText); cc:=Left(cText,k-1)
cText:=SubStr(cText,k+Len(cs01))
hOut:=FCreate(cDest)
fWrite(hOut,;
"//*********************************************"+CRLF+;
"// MS-OFFICE CONSTANTS"+CRLF+;
"// "+cc+CRLF+;
"// César E. Lozada (cesarlozada@hotmail.com)"+CRLF+;
"// "+dtos(Date())+" - "+Time()+CRLF+;
"//*********************************************"+CRLF)
cText+=cs10
DO WHILE (k:=At(cs10,cText))>0
cText:=SubStr(cText,k+Len(cs10))
k:=At(cs10,cText)
cc:=Left(cText,k-1); cText:=SubStr(cText,k)
k:=At(cs11,cc); c1:=Left(cc,k-1); cc:=SubStr(cc,k+Len(cs11))
fWrite(hOut,CRLF+"//"+c1+CRLF)
DO WHILE (k:=At(cs20,cc))>0
cc:=SubStr(cc,k+Len(cs20))
k:=At(cs21,cc)
c2:="#define "+Left(cc,k-1)
cc:=SubStr(cc,k+Len(cs21))
k:=At(cs22,cc)
c2+=" "+Left(cc,k-1)
fWrite(hOut,c2+CRLF)
cc:=SubStr(cc,k+Len(cs22))
ENDDO
ENDDO
fClose(hOut)
? "Ready"
return nil
//===========================================
2) Right click on web-page. Save web-page source code as a txt file, example Word2003.txt
3) Run application. Select txt file in step 2 and choose a ch file name, example, Word2003.ch
4) Look up in the left panel for Excel 2003 constants or go to:
http://msdn.microsoft.com/library/en-us ... 049962.asp
and repeat steps 2-3
Reading MS Constants app souce code:
// identation eaten by message editor
#include "Fivewin.ch"
//===========================================
Function MsOfficeVars()
Local cSource, cDest, cText
Local k
Local cs00:="<h1>", cs01:="</h1>"
Local cs10:=["bterm">], cs11:="</b>"
Local cs20:="<tr><td>", cs21:="</td><td>", cs22:="</td></tr>"
Local hOut
Local cc, c1, c2
IF Empty(cSource:=cGetFile("txt file|*.txt","Source file"))
return nil
ENDIF
IF Empty(cDest:=cGetFile("ch file|*.ch","Destination file"))
return nil
ENDIF
IF File(cDest) .and. !MsgNoYes("File "+cDest+" exists"+CRLF+"Overwrite it?")
return nil
ENDIF
cText:=MemoRead(cSource)
k:=At(cs00,cText); cText:=SubStr(cText,k+Len(cs00))
k:=At(cs01,cText); cc:=Left(cText,k-1)
cText:=SubStr(cText,k+Len(cs01))
hOut:=FCreate(cDest)
fWrite(hOut,;
"//*********************************************"+CRLF+;
"// MS-OFFICE CONSTANTS"+CRLF+;
"// "+cc+CRLF+;
"// César E. Lozada (cesarlozada@hotmail.com)"+CRLF+;
"// "+dtos(Date())+" - "+Time()+CRLF+;
"//*********************************************"+CRLF)
cText+=cs10
DO WHILE (k:=At(cs10,cText))>0
cText:=SubStr(cText,k+Len(cs10))
k:=At(cs10,cText)
cc:=Left(cText,k-1); cText:=SubStr(cText,k)
k:=At(cs11,cc); c1:=Left(cc,k-1); cc:=SubStr(cc,k+Len(cs11))
fWrite(hOut,CRLF+"//"+c1+CRLF)
DO WHILE (k:=At(cs20,cc))>0
cc:=SubStr(cc,k+Len(cs20))
k:=At(cs21,cc)
c2:="#define "+Left(cc,k-1)
cc:=SubStr(cc,k+Len(cs21))
k:=At(cs22,cc)
c2+=" "+Left(cc,k-1)
fWrite(hOut,c2+CRLF)
cc:=SubStr(cc,k+Len(cs22))
ENDDO
ENDDO
fClose(hOut)
? "Ready"
return nil
//===========================================