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
Nov 25, 2022 in Others by Kithuzzz
• 38,000 points
1,895 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 Nov 25, 2022 by narikkadan
• 63,600 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 Nov 21, 2022 in Others by narikkadan
• 63,600 points
1,556 views
0 votes
1 answer

Excel-VBA - How to identify Target range (more than 1 cell) is deleted in a Worksheet_Change function?

You misunderstand the purpose of the function ...READ MORE

answered Sep 23, 2022 in Others by narikkadan
• 63,600 points
3,721 views
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, 2022 in Others by narikkadan
• 63,600 points
1,348 views
+1 vote
1 answer

How to use VBA in Excel for Google Search?

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

answered Oct 7, 2022 in Others by narikkadan
• 63,600 points
1,706 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, 2022 in Others by narikkadan
• 63,600 points
718 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, 2022 in Others by narikkadan
• 63,600 points
871 views
0 votes
1 answer

Indent table pasted from Excel into Word

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

answered Oct 30, 2022 in Others by narikkadan
• 63,600 points
542 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, 2022 in Others by narikkadan
• 63,600 points
1,784 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, 2022 in Others by narikkadan
• 63,600 points
4,959 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, 2022 in Others by narikkadan
• 63,600 points
1,027 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