Share via

Excel to word conversion

Anonymous
2023-06-26T17:07:30+00:00

Hi, I want to convert a survey information which comes in the form of an excel worksheet to a form in a word document. I've basically used all the questions of the form into a survey and now it gets exported to excel. Do I use any macros to convert the excel data into that particular performa?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2023-06-29T20:26:43+00:00

    I imported your picture data into Excel and cleaned my copy up. Then I selected it and did a Copy. See Excel data below:

    Then I moved to Word and did a standard Paste command, results shown below:

    Do you want the steps in a VBA macro?.

    10+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2023-06-27T03:06:12+00:00

    If you just want a copy of the spreadsheet data in Word as a Table, you can copy and paste it.

    We would have to know the spreadsheet data layout and the desired Word layout to make other useful suggestions.

    9 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2023-06-27T05:15:10+00:00

    Hi,

    scenario

    convert excel table to word doc.

    pic1-excel

    Image

    pic2 result

    in a new word doc

    Image

    =======================

    step1

    from vbaProject References

    select

    Microsoft Word 16 object Library

    pic

    Image

    vba code

    Sub Table_Excel_to_Word()

    '## 27-06-2023 ##

    Dim ws As Worksheet

    Set ws = ActiveSheet

    Dim sPath

    sPath = ThisWorkbook.Path & "\tbl-" & Format(Date, "ddmmyyyy") & ".docx"

    Set lo = ws.ListObjects(1)

    Dim wdApp As Object

    Set wdApp = CreateObject("word.application")

    wdApp.Visible = True

    Dim wdDoc As Object

    Set wdDoc = wdApp.Documents.Add

    wdDoc.PageSetup.Orientation = 0 '<< 0=portrait / 1=landscape

    With wdDoc.PageSetup

    .TopMargin = .Application.CentimetersToPoints(1.8)

    .BottomMargin = .Application.CentimetersToPoints(1.8)

    .LeftMargin = .Application.CentimetersToPoints(0.5)

    .RightMargin = .Application.CentimetersToPoints(0.5)

    End With

    Dim wdTo As Object

    Set wdTo = wdApp.Selection

    lo.Range.Copy

    wdTo.Range.PasteExcelTable False, False, False

    Application.CutCopyMode = False

    wdDoc.tables(1) .Columns.AutoFit

    Application.DisplayAlerts = False

    wdDoc.SaveAs (sPath)

    Application.DisplayAlerts = True

    wdApp.Activate

    End Sub

    2 people found this answer helpful.
    0 comments No comments