Search the Community
Showing results for tags 'Word UDF'.
-
Hi Guys, I'm writing a script that loops through all the word documents in a given folder and inserts text into the footer. This is mostly working great. I have run into a problem where the footer in a few documents is somehow protected. If I open word manually I can select the text in the footer but I can't add to it. I can update the main text in the document so it isn't simply password protected. Rather than try and unprotect it I'm happy just to skip over it. I currently get an error on the line shown below $oRange.Inserafter ; Insert the text $oRange.Insertafter($text1 & $LastSavedDay &'/'& $LastSavedMonth &'/'& $LastSavedYear & $text2) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Insert Modified Date", _ "Error 010 Setting first footer InsertAfter location" & $file & @CRLF & "@error = " & @error & ", @extended = " & @extended) "E:\FileConversion\InsertCreationDate2.au3" (120) : ==> The requested action with this object has failed.: $oRange.Insertafter($text1 & $LastSavedDay &'/'& $LastSavedMonth &'/'& $LastSavedYear & $text2) $oRange^ ERROR It stops at the above line and does not get to the @error statement. I guess what I really need is to catch this error and jump to the next document in my for next loop. I'm happy to add the entire script to this post if anyone thinks that will help. Any Ideas? David
-
Hi all, First, I want to give a huge shout-out to the community. I'm completely self-taught, and have never had to actually ask a question before because the forum is that good at answering questions and explaining things. However, I'm kind of stumped here, and I've been stuck on this problem for almost a full day. I'm working on a script to populate drafts of deeds at work. I have the main GUI and a function (ctrl($n) and read()) for adding fields to find and data to replace it with to an array for later use with _word_docfindreplace. All of that works. However, due to the way I have the forms set up, I need to create additional fields and info based on the data that's there. Specifically, if there's only one buyer, I need to add the field [Buyer1&2] and the data in $aArray_Base for [Buyer 1]. I also need to add a field [Buyer 2] and have a blank data set in the next column over in the array, and I need to do the same for the Seller. To this end, the function parties() sets boolean variables $2buyers and $2sellers accordingly. Then, I have buyers() and sellers() to populate the data. The problem that I'm running into is that each function works... when ONLY the buyer 1 name field is filled, and when ONLY the seller 1 field is filled. So if I fill Buyer 1 Name and save it, the data is populated correctly. But when I fill Buyer 1 and Seller 1 name, only the buyer 1 data populates correctly. Worse, when I fill several fields, neither populate correctly. I have no idea why this happens. I've added messageboxes to debug throughout the entire process and can't pinpoint what's causing the issue. The entire script is below. The function(s) in question are buyers() and sellers(). Only Sellers() has messageboxes throughout. Can someone help walk me through what might be causing this and help me find a solution? Thanks a ton in advance, and sorry for the wall of text. -Anoig
-
My computer has been upgraded from Office 2010 to Office 2016. Are there any features of Office 2013 or Office 2016 which you now want to see in the Excel, Word or Outlook UDF?
-
As near as I can ascertain using the Word UDF the paragraph count does not count the numbered paragraphs in a document but counts something like all paragraphs (numbered , un-numbered, indented) minus empty lines. Is there any easy way of getting the first level numbered paragraph numbers? You'll see in my test document there are just 7 numbered paragraphs. #include <Word.au3> #include <Array.au3> Local $oWord = _Word_Create() Local $sDocument = @MyDocumentsDir & "\test.docx" Local $oDoc = _Word_DocOpen($oWord, $sDocument, Default, Default, True) $oRange = $oDoc.Range $sText = $oRange.Text $aLines = StringSplit($sText, @CR) _ArrayDisplay($aLines) $wdPropertyParas = 24 $sParas = $oDoc.BuiltInDocumentProperties($wdPropertyParas).Value $sParas = $sParas ConsoleWrite($sParas & @CRLF) test.docx
-
Good morning everyone I was talking about this UDF in this thread, but for not confusing "arguments", I opened a new thread... So, the issue I'm having, is the format of the table, that you can see in the image above... Can you help me out please? Thanks Text of the previous post: Local $oWord = _Word_Create(False) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la creazione dell'oggetto Word." & @CRLF & "Errore: " & @error) Else ; The field alreay exists, but would be nice if I can create it... I thought at _FileCreate() :) Local $oDoc = _Word_DocOpen($oWord, $sCartellaModelli & "\Esportazione_Modello.doc") If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'aggiunta di un nuovo documento Word." & "Errore: " & @error) Else Local $oRange = _Word_DocRangeSet($oWord, 0) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante il settaggio del range nel documento Word." & @CRLF & "Errore: " & @error) Else _Word_DocTableWrite($oRange, $aListView, Default) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la creazione della tabella." & @CRLF & "Errore: " & @error & "Informazioni: " & @extended) Else _Word_DocSaveAs($oDoc, $sCartellaEsportazioni & "\Esportazione_di_prova.doc") EndIf EndIf EndIf EndIf And this is the actual result:
- 10 replies
-
- word udf
- word table
-
(and 1 more)
Tagged with:
-
a Shift + Enter line break for Word 2007. is chr(11) #include <word.au3> $sText = 'Test' & @LF & 'Test' & @CR & 'Test' & @CRLF & 'test' & chr(10) & 'test' & chr(13) & 'test' $oWord = _Word_Create() $oDoc = _Word_DocAdd($oWord) $oRange = $oDoc.Range $oRange.InsertAfter ($sText) $iEnd = $oRange.End _Word_DocSaveAs($oDoc,'c:\test.doc') hehe dancing all around chr(11)