Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

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

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/1112da9dab9faf31852572c7005b126a.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1