Reinhardt1julian Posted February 22, 2014 Posted February 22, 2014 (edited) I have a RichEdit and the content of said Edit should be saved to a .doc file. I already found the Word User Defined Functions (http://www.autoitscript.com/autoit3/docs/libfunctions/Word%20Management.htm), but I can't seem to find a way to actually write to that file. This is the code I have: $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" $where= FileSaveDialog("Plan Speichern", $MyDocsFolder,"Microsoft Word Dokumente (*.doc)", 2) If StringInStr($where,".doc") Then $word = _Word_Create(false,true) $doc = _Word_DocAdd($word) _Word_DocSaveAs($doc,$where) $infile = _GUICtrlRichEdit_StreamToFile($Edit1, $where) ;this is what I tried _Word_DocSave($doc) _Word_DocClose($doc) _Word_Quit($word) Else $wohinexport = $wohinexport & ".doc" $word = _Word_Create(false,true) $doc = _Word_DocAdd($word) _Word_DocSaveAs($doc,$where) $infile = _GUICtrlRichEdit_StreamToFile($Edit1, $where) _Word_DocSave($doc) _Word_DocClose($doc) _Word_Quit($word) EndIf If anyone could thell me what the correct function is to write to that document, I would be so happy Thank you, Reinhardt1julian Edited February 22, 2014 by Reinhardt1julian
water Posted February 22, 2014 Posted February 22, 2014 See the examples for the _Excel_RangeDocSet functions. You set the cursor and then insert text at this location. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Reinhardt1julian Posted February 22, 2014 Author Posted February 22, 2014 So there is no way of "properly" doing it, so the word document doesn't need to be visible
water Posted February 22, 2014 Posted February 22, 2014 Sure there is a way. $vRange = $oDoc.Range $vRange.InsertBefore("Text you want to insert") My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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