' \lib\runVBAFilesInOffice\runVBAFilesInOffice.vbs -word backgroundImage -c main %CD%
'
' http://renenyffenegger.blogspot.ch/2014/10/creating-psychedelic-images-with-word.html
sub main(path)
dim background_image as shape
' Load image
set background_image = activeDocument.shapes.addPicture( _
fileName := path & "\background.png", _
linkToFile := false)
' Place Image's top left corner to page's top left corner:
background_image.relativeVerticalPosition = wdRelativeVerticalPositionPage
background_image.top = 0
background_image.relativeHorizontalPosition = wdRelativeHorizontalPositionPage
background_image.left = 0
' Use entire page (size of paper is assumed to be A4)
background_image.width = inchesToPoints( 8.267)
background_image.height = inchesToPoints(11.69 )
' Allow to write text above the image
background_image.zOrder msoSendBehindText
' Close document without being asked
activeDocument.saved = true
end sub
'
' ..\..\..\runVBAFilesInOffice.vbs -word line_width -c main
'
option explicit
dim ad_sh as shapes
dim pageWidth as double
dim curLineTop as double
sub main()
set ad_sh = activeDocument.shapes
pageWidth = activeDocument.pageSetup.pageWidth
curLineTop = 3
call nextLine(0.25)
call nextLine(0.50)
call nextLine(1 )
call nextLine(2 )
call nextLine(5 )
call nextLine(10 )
activeDocument.saved = true
end sub
private sub nextLine(w as double)
dim line_ as shape
set line_ = ad_sh.addLine(centimetersToPoints( 3), _
centimetersToPoints( curLineTop), _
pageWidth - centimetersToPoints(3), _
centimetersToPoints( curLineTop))
line_.line.weight = w
curLineTop = curLineTop + 1
end sub
'
' ..\..\..\runVBAFilesInOffice.vbs -word addConnector -c main
'
sub main()
dim connector as shape
set shape = activeDocument.shapes.addConnector(msoConnectorStraight, 20, 50, 400, 200)
shape.line.weight = 5#
shape.line.foreColor.rgb = rgb(255, 50, 20)
activeDocument.saved = true
end sub