Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Trying to use the GoTo method of the Word.Application ActiveX object uin JavaScript

$
0
0

Hi There

I am trying to use the Goto method of the Word ActiveX object. I am trying to open a document and go to a named bookmark. If I use this code in VB it works, so I'm sure the approach is possible, I just can't get JavaScript to work with it.

Here is the code I am using, the error I get from IE is Object Expected:

Hope someone can help! Any help would be much appreciated

function PageLoad()

{

var WordApp = new ActiveXObject('Word.Application');

WordApp.Visible =

true;

var documentlocation = crmForm.all.new_documentlocation.DataValue;

var wd = WordApp.Documents.Open(documentlocation);

wd.Select();

//var What = ActiveXObject('Word.WdGoToItem.wdGoToBookmark');

//var Name = CreateObject();

var Name = 'TestFred';

var wr = wd.Selection.GoTo(What : Word.WdGoToItem.wdGoToBookmark,Name : 'TestFred');

//var wr = WordApp.Selection.GoTo(What:=wdGoToBookmark, Name:="TestFred");

//alart("Bookmark found " + WordApp.Documents.ActiveWindow.Bookmarks.Count.ToSting);

}


Viewing all articles
Browse latest Browse all 3527

Trending Articles



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