I create a blank document like this:
Then I fill the document with 1 image, some text and a table with values. What I really need to do is:
When The document is complete, I need to save it as a .pdf file THEN create a NEW ONE, Blank Document, to fill it again with others data but with the same functions
the method to create a blank document is inside a loop, and it's working FINE. But when it comes to create the blank document of number 407 and it tries to run this line of code, it gives me an error:
With this, I create a new blank document(I think so) and I just past what was copied in the first time.
What could it be? Why the error happens only when I try to run this in the 407th time ?
Code:
Private Word_App As Word.Application Private Word_Doc As Word.Document Private Word_Rtf_Doc As Word.Document Private Word_Table As Word.Table Private Word_Range As Word.Range Private objRow As Row Private objCell As Cell Private sCellText As String Private Range As Range Private strPath As String Private iMarcaPaginas As Integer Private iMarcaCartasIndividuais As Integer Private strTempLogo As String iMarcaPaginas = 0 iMarcaCartasIndividuais = 1 strPath = strCaminho Set Word_App = New Word.Application Set Word_Doc = Word_App.Documents.Add(DocumentType:=wdNewBlankDocument) Set Word_Range = Word_App.ActiveDocument.Range() Word_App.Options.CheckGrammarAsYouType = False Word_App.Options.CheckSpellingAsYouType = False
When The document is complete, I need to save it as a .pdf file THEN create a NEW ONE, Blank Document, to fill it again with others data but with the same functions
the method to create a blank document is inside a loop, and it's working FINE. But when it comes to create the blank document of number 407 and it tries to run this line of code, it gives me an error:
Code:
Set Word_Doc = Word_App.Documents.Add(DocumentType:=wdNewBlankDocument) Word_App.selection.Paste
What could it be? Why the error happens only when I try to run this in the 407th time ?
Comment