I have to click on a word document in Sharepoint Server.
Once the document is opened, i have to edit it in the middle and at the end. To do that i want to calculate the number of pages, paragraphs.
I tried the following code
Set wrdApp = CreateObject("Word.Application") ' Create Word App object
Browser("Word07").Page("Word07").Link("DOC_07-5.6MB").Click ' click on the link to open word doc
But i get an error on line 3, saying "This command is not available because no document is open".
But the word document is open.
So how can we get handle to such objects which are opened from SharePoint to use Word document properties.
Thanks in advance [img]/images/graemlins/smile.gif[/img]
You created a word app. object and then opened a word document via a link within a browser. The 2 are not the same. I think if you save via your link locally and then open the saved document via your vbs object you will be good.
>But the word document is open.
No. In your case: Open is instance of Word activated by SharePoint. You are dealing with that in the line #2.
In the line #1, when you say:
Set wrdApp = CreateObject("Word.Application")
you are creating another instance of Word object.
To open this instance you need:
and so on...
To be able to manipulate the same instance of Word object, you need GetObject instead of CreateObject