Sign in to follow this  
Followers 0
Sxuiddly

Windows 7 Word Function

2 posts in this topic

Hi,

Found this old application I wrote a while ago for XP, it takes user input and customizes a word document for use. I used it frequently at school, but moved away from it because of its limitations. When i ran it on my new Windows 7 (64bit) system it didn't work. I opened the script and got this error.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Michael\Documents\SchoolApp\Rev 8\New School Workbook.au3"    
--> Word.au3 Error from function _WordDocOpen, $_WordStatus_InvalidObjectType
--> Word.au3 Error from function _WordDocGetCollection, $_WordStatus_InvalidObjectType
--> Word.au3 Error from function _WordDocFindReplace, $_WordStatus_InvalidDataType
--> Word.au3 Error from function _WordDocFindReplace, $_WordStatus_InvalidDataType
--> Word.au3 Error from function _WordDocSaveAs, $_WordStatus_InvalidDataType

The function that does all the work is below. Everything else in the script works fine and it still works seamlessly on my old XP machine.

Func Creation() 
        $oWordApp = _WordCreate(@ScriptDir & "\" & "SchoolWorkTemplate.doc",0,1)
        $oDoc = _WordDocGetCollection($oWordApp, 0)
        $oFindSub = _WordDocFindReplace($oDoc, "Subject", GUICtrlRead($SubInput))
        $oFindDate = _WordDocFindReplace($oDoc, "Date", _DateTimeFormat( _NowCalc(),1))
        $oSavePath = _Pathfull(@ScriptDir & "\School\")
        $oSaveAs = _WordDocSaveAs($oDoc, $oSavePath & GuiCtrlRead($SubInput) & " - " & _DateTimeFormat( _NowCalc(),1) & " - " & @Hour & "-" & @Min & "-" & @Sec)
        $oFocus = WinActivate(GUICtrlRead($SubInput))
        $oTypeReady = Send("{DOWN}{DOWN}{DOWN}")
        $oSave = _WordDocSave($oDoc)
        $oUnhide = _WordPropertySet($oDoc, "visible", true)
        exit
    EndFunc

Any help is greatly appreciated.

Share this post


Link to post
Share on other sites



Same here... after i just installed a new fresh win7x64 installation it doesnt work yet. bevore the re-installation of win7 it worked perfectly..

Any suggestions how to solve this?

Thanks :)

Greetz

Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
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
Sign in to follow this  
Followers 0