vbscript - Changing Whole Page Color via COM object -


i trying change whole page color in ms word using vbscript com interface. code not seem work. tried following code:

option explicit  ' variables dim objdoc, objfile, objword  ' create word object set objword = createobject( "word.application" )  ' create document object set objdoc = objword.documents.add  ' make word visible objword.visible = true  ' set default text objdoc.content.text="hello"  objdoc.background.fill.visible = true objdoc.background.fill.backcolor.rgb = rgb(55, 255,155)  ' close active document 'objdoc.close  ' close word 'objword.quit 

(i tried using luacom abandoned due limitations!)

i using windows 8. can point doing wrong... or things different in win8.

when setting background color programmatically it's displayed if change view type online layout:

objdoc.background.fill.visible = true objdoc.background.fill.forecolor.rgb = rgb(55, 255, 155) objdoc.background.fill.solid objword.activewindow.view.type = 6 

it'll visible in layout, though, might bug.

on more general note: please drop habit of commenting obvious. comments shouldn't rephrase actual statement says, illuminate purpose of statement or group of statements when not obvious.


Comments