Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 183671

Reporting with word docuements

$
0
0

Hi,

 

My need today is to create a report for a worklow which creates a VM.

 

My first thought was to create a word document with bookmarks, and use VCO PowerShell plugin to run a script which edit bookmarks values..

 

I end up with a well-running script on my PowerShell host. But as soon as I try to call it from VCO, I end up with messages llike this

 

System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.

 

Script is very light and simple

 

$Filename = "C:\data\Scripts\Bookmark1.docx"

$Filename = "C:\data\Scripts\Bookmark1.docx"

$Word = New-Object -ComObject Word.Application

$Document = $Word.documents.open($Filename)

$Bookmark = $Document.Bookmarks("Book2").Select()

$Word.Selection.text = "Bookmark is filled"

 

I've digged up a bit, and it seems that, as soon as VCO hits line 4, it goes boom.

 

Does anybody had any experience with this ? Can you help me ?

 

Thanks


Viewing all articles
Browse latest Browse all 183671

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>