Most of my future PBCode will involve manipulating MSWord, but I'm off to a slow start.
PB8 samples has an oWord.bas and if I add these few lines to this PB8 code, it will open the referenced document as expected.
~~
LET vVnt = 0
DIM vPath AS VARIANT
DIM vDocs AS VARIANT
vDocs="IansTest.doc"
vPath="C:\PBWin90\Samples\Com\Word\"
OBJECT CALL oWordApp.ChangeFileOpenDirectory (vPath) TO vVnt
SET oWordDoc = vVnt
LET vVnt = 0
OBJECT CALL oWordApp.Documents.Open(vDocs)
IF OBJRESULT OR ERR THEN
DisplayResult "MSWORD was not able to Open a new document."
GOTO Terminate
END IF
~~
Using the oWord.bas from PB9 samples and adding the code below doesn't generate errors but does not open the document.
The oWord.inc shows ChangeFileOpenDirectory as needing a string and changing to a variant does not alter the issue.
~~
DIM vDoc AS VARIANT
DIM sPath AS STRING
sPath ="C:\PBWin90\Samples\Com\Word\"
oWordApp.ChangeFileOpenDirectory (sPath)
vDoc="IansTest.doc"
oWordApp.Documents.Open(vDoc)
IF ISFALSE ISOBJECT(oWordDoc) THEN
MSGBOX "MSWORD was not able to open document."
GOTO Terminate
END IF
~~
If I comment out the PB9 code which adds a new document, then the Doc open will fail with an error returned from ISOBJECT
Can anyone point me in the right direction please.
TIA
Ian B
PB8 samples has an oWord.bas and if I add these few lines to this PB8 code, it will open the referenced document as expected.
~~
LET vVnt = 0
DIM vPath AS VARIANT
DIM vDocs AS VARIANT
vDocs="IansTest.doc"
vPath="C:\PBWin90\Samples\Com\Word\"
OBJECT CALL oWordApp.ChangeFileOpenDirectory (vPath) TO vVnt
SET oWordDoc = vVnt
LET vVnt = 0
OBJECT CALL oWordApp.Documents.Open(vDocs)
IF OBJRESULT OR ERR THEN
DisplayResult "MSWORD was not able to Open a new document."
GOTO Terminate
END IF
~~
Using the oWord.bas from PB9 samples and adding the code below doesn't generate errors but does not open the document.
The oWord.inc shows ChangeFileOpenDirectory as needing a string and changing to a variant does not alter the issue.
~~
DIM vDoc AS VARIANT
DIM sPath AS STRING
sPath ="C:\PBWin90\Samples\Com\Word\"
oWordApp.ChangeFileOpenDirectory (sPath)
vDoc="IansTest.doc"
oWordApp.Documents.Open(vDoc)
IF ISFALSE ISOBJECT(oWordDoc) THEN
MSGBOX "MSWORD was not able to open document."
GOTO Terminate
END IF
~~
If I comment out the PB9 code which adds a new document, then the Doc open will fail with an error returned from ISOBJECT
Can anyone point me in the right direction please.
TIA
Ian B
Comment