How to add text on new page in word doc via excel vba

0 votes

How do I add text row wise on new page in word doc. i.e. each row from excel will be on new page on word document.

Sub marine()

Dim i As Long, j As Long, fD As Long
Dim objWord As Object, objDoc As Object

With DATA

    fD = .Range("A" & .Rows.Count).End(xlUp).Row
    If fD = 1 Then MsgBox ("No data on Data worksheet."): Exit Sub

    Set objWord = CreateObject(“Word.Application”)
    Set objDoc = objWord.Documents.Add
    objWord.Visible = True

    For i = 2 To fD

          'How do I add text row wise on new page in word doc. i.e. each row from excel will be on new page on word document.

    Next i

    objDoc.SaveAs (ThisWorkbook.Path) '& "\Output.docx")

End With



End Sub
2 days ago in Others by Kithuzzz
• 20,660 points
6 views

1 answer to this question.

0 votes

First start with:

objDoc.Range.Insertafter vbCr & Chr(12) & .Range("A" & i).Text

Or you might automate a mail merge. I hope this helps you.

answered 2 days ago by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

How do delete an specific page in a word document using Excel VBA?

Check the code below. I eliminated the ...READ MORE

answered 5 days ago in Others by narikkadan
• 37,660 points
14 views
0 votes
1 answer
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24 in Others by narikkadan
• 37,660 points
110 views
0 votes
1 answer

How to use VBA in Excel for Google Search?

Try this: Private Const LicenseRegistration As String = ...READ MORE

answered Oct 7 in Others by narikkadan
• 37,660 points
117 views
0 votes
1 answer

Multiple find and replace in MS Word from a list in MS Excel

If I understand you correctly, you want ...READ MORE

answered Oct 28 in Others by narikkadan
• 37,660 points
40 views
0 votes
1 answer

Trying to create an enclosing bookmark after pasting a picture from Excel into Word using VBA

Try this: Sub IMPORT_TO_WORD() Dim ws1 As Worksheet, ws2 ...READ MORE

answered Oct 30 in Others by narikkadan
• 37,660 points
33 views
0 votes
1 answer

Indent table pasted from Excel into Word

It is feasible to pick up the ...READ MORE

answered Oct 30 in Others by narikkadan
• 37,660 points
39 views
0 votes
1 answer

Word Mail Merge with Excel data has to be saved in different files with custom names

Try this: Public Sub Mail_Merge() On Error GoTo ErrH Dim ...READ MORE

answered Nov 6 in Others by narikkadan
• 37,660 points
38 views
0 votes
1 answer

How can I find and replace text in Word using Excel VBA?

Try this code Option Explicit Const wdReplaceAll = 2 Sub ...READ MORE

answered Oct 15 in Others by narikkadan
• 37,660 points
85 views
0 votes
1 answer

Excel VBA : HOW TO PRINT THE TEXT IN A CELL (like Wrap Text)

Use a LineFeed character to create a ...READ MORE

answered Oct 27 in Others by narikkadan
• 37,660 points
56 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP