General information
Category:
Windows API functions
>I did setup a worrd template with bookmarks and wnat to jump to them in VFP and insert text to it like:
>
>with oWord
> .Documents.Add ("C:\WINDOWS\Application Data\Microsoft\Templates\Collect1.dot", .F.,0)
> .ActiveDocument.SaveAs("a.doc" )
> .Selection.GoTo("toName" )
> .Selection.TypeText("ERGERGERGERGERGERGERG")
> .Visible=.t.
>endwith
>
>but this gives me an OLE error.
>How can I implement jumping to bookmarks??
>
>Peter
Hi Peter,
Your problem is with the parameters since VBA uses named parameters. Try something like this
HTH,
Ken
WITH oWord
.DOCUMENTS.OPEN(lcTemplate)
.ACTIVEDOCUMENT.SAVEAS(lcOutPut)
.SELECTION.GOTO(wdGoToBookmark,,,'DATEBOOKED')
.SELECTION.TYPETEXT(lcDate)
.SELECTION.GOTO(wdGoToBookmark,,,'CONTACTNAME')
.SELECTION.TYPETEXT(lcContact)
.SELECTION.GOTO(wdGoToBookmark,,,'CONTACTCLIENT')
.SELECTION.TYPETEXT(lcClient)
.SELECTION.GOTO(wdGoToBookmark,,,'CONTACTADDRESS')
.SELECTION.TYPETEXT(lcContAddr)
.SELECTION.GOTO(wdGoToBookmark,,,'CONTACTDEAR')
.SELECTION.TYPETEXT(lcContDear)
.SELECTION.GOTO(wdGoToBookmark,,,'CLIENTNAME')
.SELECTION.TYPETEXT(lcClient)
.ACTIVEDOCUMENT.CLOSE(.T.)
ENDWITH
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only