question

CiceroCruz-2219 avatar image
0 Votes"
CiceroCruz-2219 asked emilyhua-msft edited

Macro Selection.InsertFile change Line and Paragraph into document destinity

I'm using Selection.InsertFile to join some documents that I generate individually, it happens that in the tables there is a spacing change...

See that the format changes after inserting it by Selection.InsertFile method... how do i configure word to not modify the source format

197835-chamado-word-autron.png


office-vba-dev
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The macro:

 Sub Insere_Componente()
    
 Dim cDir As String
    
 cDir = ActiveDocument.Variables.Item("cDiretorio").Value
    
 Selection.GoTo What:=wdGoToBookmark, Name:="INSERE_COMPONENTE"
 Selection.Find.ClearFormatting
    
 For i = 0 To UBound(aComponente) - 1 Step 1
       
     If Not (aComponente(i, 1) = ".DOCX") Then
         If aComponente(i, 2) = "1" Then
             Selection.InsertBreak Type:=wdPageBreak
         End If
         Selection.InsertFile FileName:=cDir & aComponente(i, 1), Range:="", _
         ConfirmConversions:=False, Link:=False, Attachment:=False
     End If
    
 Next
    
 End Sub
0 Votes 0 ·

Hi @CiceroCruz-2219

As your issue is more related to macro, I would modify the tag.
Thanks for your understandings.

0 Votes 0 ·

0 Answers