exodius Posted December 19, 2006 Share Posted December 19, 2006 Anyone have any ideas on how to extract the text typed into the embedded word object in the example below without having to simply save the word document? In my actual script I have it automatically open a blank Word document and want to utilize the spelling/grammar checker but can't find a way to get it to give me the text. expandcollapse popup#include <IE.au3> #include <GUIConstants.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded() GUICreate("Embedded Word control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Open = GUICtrlCreateButton("Open File", 10, 420, 100, 30) $GUI_Button_OK = GUICtrlCreateButton("OK", 200, 420, 100, 30) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_Button_OK MsgBox ( 0, "", "") Case $GUI_Button_Open $sFile = FileOpenDialog("Open Word File", @MyDocumentsDir, "Word Doc (*.Doc)") If $sFile <> "" Then _IENavigate ($oIE, $sFile, 0) While $oIE.ReadyState <> 4 Sleep(50) WEnd $oDoc = $oIE.Document $oWord = $oDoc.Application $oDoc.CommandBars ("Reviewing").visible = False $oDoc.CommandBars ("Standard").Visible = False EndIf EndSwitch Sleep(50) WEnd _IENavigate ($oIE, "about:blank") $oDoc = 0 $oWord = 0 GUIDelete() Exit Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted December 19, 2006 Moderators Share Posted December 19, 2006 You may want to take a look at this.Custom Spell Checker Link to comment Share on other sites More sharing options...
exodius Posted December 22, 2006 Author Share Posted December 22, 2006 I figured it out after looking at your Word UDF thread in the Examples forum... This'll do the trick. Thanks big_daddy! expandcollapse popup#include <IE.au3> #include <GUIConstants.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded() GUICreate("Embedded Word control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Open = GUICtrlCreateButton("Open File", 10, 420, 100, 30) $GUI_Button_OK = GUICtrlCreateButton("OK", 200, 420, 100, 30) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_Button_OK MsgBox ( 0, "", $oDoc.Range.Text) Case $GUI_Button_Open $sFile = FileOpenDialog("Open Word File", @MyDocumentsDir, "Word Doc (*.Doc)") If $sFile <> "" Then _IENavigate ($oIE, $sFile, 0) While $oIE.ReadyState <> 4 Sleep(50) WEnd $oDoc = $oIE.Document $oWord = $oDoc.Application ; Put document into 'Web View' mode ;$oWord.Activewindow.View = 4 ; Manage display of toolbars $oDoc.CommandBars ("Reviewing").visible = False $oDoc.CommandBars ("Standard").Visible = False EndIf EndSwitch Sleep(50) WEnd _IENavigate ($oIE, "about:blank") $oDoc = 0 $oWord = 0 GUIDelete() Exit Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now