Two Problems concerning manipulating a Word document (OpenInsight 32-Bit)
At 24 APR 2007 12:34:44PM W Shepard wrote:
1) The following code successfully inserts the word "Fruitcake" at the beginning of my document, but it does not set the font to 8 point. Can anyone see what I'm doing wrong?
OpenWordFile(filename,oWrd,oDoc)
oSelection=oleGetProperty(oWrd,"SELECTION")
* Set font size to 8 point
oFont=OleGetProperty(oSelection,'FONT')
OlePutProperty(oFont,"SIZE",8)
OlePutProperty(oSelection,"FONT",oFont)
OlePutProperty(oSelection,"TEXT","Fruitcake")
OlePutProperty(oDoc,'SELECTION',oSelection)
Of course, I don't want to insert the word, I REALLY want to change the font of the existing text to 8 point. I've tried several different approaches, but cannot select the text range. The following code, it seems to me, should overwrite the entire document with the word "Fruitcake" in 8 point, but in fact, nothing happens:
outputsize=dir(filename)
OpenWordFile(filename,oWrd,oDoc)
oRange=oleGetProperty(oDoc,'RANGE',0,outputsize-1)
ret=OleCallMethod(oRange,'SELECT')
oSelection=oleGetProperty(oRange,"SELECTION")
OlePutProperty(oSelection,"TEXT","Fruitcake")
OlePutProperty(oRange,'SELECTION',oSelection)
OlePutProperty(oDoc,'RANGE',oRange)
Can any of you experts see what I'm missing? Other than the boat?
Wayne