Jump to content

Appending text in winWord -Error


autosc
 Share

Recommended Posts

this code working but sometimes i am getting error :

CODE
$sFilePath = "test.doc"

$filep = FileOpenDialog("Open text File to append ", @ScriptDir, "text (*.txt)")

$sText1 = FileRead($filep)

$oWordApp = _WordCreate($sFilePath, 0, 0)

$oDoc = $oWordApp.ActiveDocument

$oRng1 = $oDoc.Range

$oRng1.InsertAfter ($sText1);& @CR

$iEnd = $oRng1.End

$oRng2 = $oDoc.Range($iEnd-StringLen($sText1), $iEnd)

$oRng2.Font.Bold = True

_WordDocSave($oDoc)

_WordQuit($oWordApp)

in scite i am getting :

>"C:\Program\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\pppppppp\wordAPPEND.au3"

C:\testword\wordAPPEND.au3 (21) : ==> The requested action with this object has failed.:

$oRng1.InsertAfter ($sText1)

$oRng1.InsertAfter ($sText1)^ ERROR

>Exit code: 0 Time: 12.098

as compiled script : auto it error message with the above lines :

my question:

how can i stop the autoit error messages ?

and what is going wrong , sometimes work , sometimes not !

thanks ..

Link to comment
Share on other sites

my question:

how can i stop the autoit error messages ?

and what is going wrong , sometimes work , sometimes not !

see COM Error Handling in the help file

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

see COM Error Handling in the help file

Big daddy ... here is the report from scite ... after i executed 12 times ...

as i said it works..and sometime halts

CODE
>"C:\Program\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\WORD 1\wordAPPEND1.au3"

--> COM Error Encountered in wordAPPEND1.au3

----> $WordComErrorScriptline = 21

----> $WordComErrorNumberHex = 00000005

----> $WordComErrorNumber = 5

----> $WordComErrorWinDescription = Conversion of parameters failed

----> $WordComErrorDescription =

----> $WordComErrorSource =

----> $WordComErrorHelpFile =

----> $WordComErrorHelpContext =

----> $WordComErrorLastDllError = 0

--> COM Error Encountered in wordAPPEND1.au3

----> $WordComErrorScriptline = 24

----> $WordComErrorNumberHex = 80020009

----> $WordComErrorNumber = -2147352567

----> $WordComErrorWinDescription =

----> $WordComErrorDescription = Value beyond intervall

----> $WordComErrorSource = Microsoft Word

----> $WordComErrorHelpFile = C:\Program\Microsoft Office\OFFICE11\1053\wdmain11.chm

----> $WordComErrorHelpContext = 37376

----> $WordComErrorLastDllError = 0

--> COM Error Encountered in wordAPPEND1.au3

----> $WordComErrorScriptline = 25

----> $WordComErrorNumberHex = 000000A9

----> $WordComErrorNumber = 169

----> $WordComErrorWinDescription = Variable must be of type 'Object'.

----> $WordComErrorDescription = Value beyond intervall

----> $WordComErrorSource = Microsoft Word

----> $WordComErrorHelpFile = C:\Program\Microsoft Office\OFFICE11\1053\wdmain11.chm

----> $WordComErrorHelpContext = 37376

----> $WordComErrorLastDllError = 0

>Exit code: 0 Time: 23.960

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...