Jump to content

problems opening Word?


Go to solution Solved by water,

Recommended Posts

Posted (edited)

Hi all, I had created a script back in November with the latest at that time of AutoIt, it worked and then I haven't needed it since. Now I have downloaded the latest AutoIt on a different computer and copied the same script over. It works except for when it get to the spot where it's supposed to open a word doc. This isn't working. I have tried making a new script solely meant to open a word doc, and cannot get it to open, what am I doing wrong?

This is my code,

#include <Word.au3>


Local $location = InputBox( "Location.", "What is the name of the file including the extension, {for example .rtf}")
Sleep ( 3000)
Local $WordCreate = _Word_Create()
Sleep ( 3000)
Local $path = @ScriptDir & "\"&$location
Sleep ( 3000)
_Word_DocOpen( $WordCreate, $path,)

I would normally run the script in the same directory, of the file name I intend to open, I would then enter the name including the extension, for example "open.rtf". Is there something i'm missing?? something that changed with a recent update?

Thanks

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

Posted

When you run your script from SciTE do you get any error messages?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

Thanks for the replies, 

  On 8/31/2015 at 4:46 AM, DakotaSamuel said:

Your code has a few typos. Try this:

#include <Word.au3>

Local $location = InputBox( "Location.", "What is the name of the file including the extension, {for example .rtf}")
Local $WordCreate = _Word_Create()
Local $path = @ScriptDir & "\" & $location
_Word_DocOpen( $WordCreate, $path)

And I don't believe the sleeps are needed either.

 

-DakotaSamuel

Expand  

I tried the code, but still nothing, I open it, it just runs and goes away, the Word I specify doesn't open. I didn't see any errors etc. i'm wondering if it is something to do with my computer?  

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

Posted
  On 9/1/2015 at 12:04 AM, donnyh13 said:

Thanks for the replies, 

I did try the code, still nothing, I run it and it just runs and goes away, the word I specify doesnt open.no erroes etc. im wondering if it is something to do with my computer?  

You have no error checking, so It wouldn't report an error.

Does this display an error?

 

#include <Word.au3>

Local $location = InputBox( "Location.", "What is the name of the file including the extension, {for example .rtf}")
Local $WordCreate = _Word_Create()
Local $path = @ScriptDir & "\" & $location
_Word_DocOpen( $WordCreate, $path)
If @Error Then Msgbox(0,'',"_Word_DocOpen returned @error: " & @error)

 

Posted (edited)

Hi Kaisies, whoops, I thought you meant the syntax check type errors. I tried your code and it returned code 1.

The installer says 3.3.12.0 for AutoIt. 

I am actually using WPS writer ( which worked before with the old code) that version is 9.1.0.4758

Thanks

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

Posted (edited)

Thanks Kaisies,

Any hints on how to correct it? As I am not very fluent with all of this code language.

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

  • Solution
Posted

@error = 1 means: $oAppl is not an object
It looks like _Word_Create already returned an error. I suspect there is no MS Word installed on your machine.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Thanks,

I really appreciate your help!

 

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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