Michael1996 Posted February 13 Share Posted February 13 Hi all, i am trying to create a script, that replaces a placeholder text with numbers counting up in an existing word document. the doc multiple cells with the same placeholders twice in each cell. this works fine my code: #include <Word.au3> $WordObject=_Word_Create () $WordDocObject=_Word_DocOpen ($WordObject, "AveryMuster.doc") $i = 0 $beginn = 3380001 While $i <= 51 _Word_DocFindReplace($WordDocObject, "platz", $beginn + $i, 1) _Word_DocFindReplace($WordDocObject, "platz", $beginn + $i, 1) $i =$i+1 WEnd the doc Link to comment Share on other sites More sharing options...
Michael1996 Posted February 13 Author Share Posted February 13 (posted to soon, here is the rest) what it does : after changing the placeholder to the specified number i want to change the upper line in each cell to a barcode-font (code 39), which i am having problems with. if i change the upper text in each cell to the barcode font beforehand, the script cant read it and starts the replacing with the second line in the first cell what it does if i change the font beforehand: i tried fiddeling around with "$sFontName = ..." but cant get it to do what i want what i want (when scanning the barcode it reads the number below the barcode): if you are wondering the doc is a form for stickers, i hope you can understand what i want any ideas? Link to comment Share on other sites More sharing options...
water Posted February 13 Share Posted February 13 Please post the code you run. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Michael1996 Posted February 20 Author Share Posted February 20 #include <Word.au3> $WordObject=_Word_Create () $WordDocObject=_Word_DocOpen ($WordObject, "AveryMuster.doc") $i = 0 $beginn = 3380001 While $i <= 51 _Word_DocFindReplace($WordDocObject, "platz", $beginn + $i, 1) _Word_DocFindReplace($WordDocObject, "platz", $beginn + $i, 1) $i =$i+1 WEnd Link to comment Share on other sites More sharing options...
water Posted February 20 Share Posted February 20 Sorry, I missed the code you already posted in #1. I suggest to replace _Word_DocFindReplace with _Word_DocFind. _Word_DocFind returns the range of the found placeholder. You then can change the placeholder to your number and set the font of the range. Something like (untested): While $i <= 51 ; Replace/format first placeholder $oRange = _Word_DocFind($WordDocObject, "platz", $beginn + $i, 1) $oRange.Text = $beginn + $i $oRange.Font.Name = "FontName" ; needs to be changed by you $oRange.Font.Size = 12 ; needs to be changed by you ; Replace second placeholder _Word_DocFindReplace($WordDocObject, "platz", $beginn + $i, 1) $i =$i+1 WEnd My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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