Michael1996 Posted February 13, 2023 Posted February 13, 2023 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
Michael1996 Posted February 13, 2023 Author Posted February 13, 2023 (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?
water Posted February 13, 2023 Posted February 13, 2023 Please post the code you run. 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
Michael1996 Posted February 20, 2023 Author Posted February 20, 2023 #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
water Posted February 20, 2023 Posted February 20, 2023 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 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