Consulting

Results 1 to 3 of 3

Thread: Range copy issue when transforming excel to word

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Range copy issue when transforming excel to word

    Hi There

    I have to export certain columns from an excel sheet to a word document.
    Problem:
    ActiveSheet.Range("B:B , D").Copy does not copy only Column B and D but also every column in between (in test document column c also gets pasted).

    How do I get rid of this? I only want Column B and D, nothing else.

    Thank you for your help in advance!
    Greetz

    testsheet.xlsm

    Sub export_excel_to_word()    
        Set obj = CreateObject("Word.Application")
        obj.Visible = True
        Set newObj = obj.Documents.Add
        ActiveSheet.Range("B:B, D:D").Copy
        newObj.Range.Paste
        Application.CutCopyMode = False
        obj.Activate
    End Sub
    Last edited by haudrauf64; 03-25-2022 at 05:18 AM. Reason: code added

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •