Importing Excel Range data to Word doc
Results 1 to 5 of 5

Thread: Importing Excel Range data to Word doc
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Importing Excel Range data to Word doc

    Hello All,

    I need to import an excel 'Range' which contains texts and images into Word document. I have used the below code.
    Problem is images are misplaced after importing into word document and few images are above the text content.

    how do i maintain the structured format even after importing? Please help

    Code:

    Sub SaveDoc()
    Dim rangetocopy As Range
    Dim WordApp As Word.Application
    Dim myDoc As Word.Document
    Dim WordTable As Word.Table




    Set rangetocopy = Range("A1:C203")
    Set WordApp = New Word.Application
    WordApp.Visible = True
    Set myDoc = WordApp.Documents.Add
    rangetocopy.Copy
    myDoc.Words(1).PasteExcelTable False, False, False


    End Sub

  2. #2
    Retired Moderator Macropod's Avatar
    Join Date
    Aug 2007
    Location
    Canberra, Australia
    Posts
    3,279
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Importing Excel Range data to Word doc

    You might try varying your PasteExcelTable arguments. Otherwise, you might try:
    myDoc.Range.PasteSpecial DataType:=wdPasteOLEObject
    to insert the actual worksheet, or:
    myDoc.Range.PasteAndFormat wdChartPicture
    to insert the content as an image.
    Cheers
    Paul Edstein
    [MS MVP - Word]

  3. #3
    New Member
    Join Date
    Jun 2019
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Importing Excel Range data to Word doc

    Hello Paul,

    thanks for your reply. I tried changing the PasteExcelTable arguments, I am getting the contents in word as tabular form (I will not be able to edit the word contents properly). But I need the word contents to be in normal format where I can edit the word document easily.
    Please suggest

  4. #4
    Retired Moderator Macropod's Avatar
    Join Date
    Aug 2007
    Location
    Canberra, Australia
    Posts
    3,279
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Importing Excel Range data to Word doc

    Provided the first argument is kept 'False' , either of the second two of the .PasteExcelTable arguments will allow you to edit the content in Word - as will .PasteSpecial DataType:=wdPasteOLEObject.
    Cheers
    Paul Edstein
    [MS MVP - Word]

  5. #5
    New Member
    Join Date
    Jun 2019
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Importing Excel Range data to Word doc

    If i use .PasteExcelTable with second arguments as False True False -Entire excel range content will be saved in word as table format and same result with paste special. If I use False False True - Each excel cell content is saved as tabular form. I cannot give backspace or edit the contents properly

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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