HOW TO COPY A CELL CONTENTS FOR PASTING IN WORD

aparna

New Member
Joined
Nov 4, 2005
Messages
16
I AM NOT ABLE TO COPY THE CELL CONTENTS FOR PASTING IT IN A WORD DOCUMENT. NO MATTER WHAT I DO WHENEVER I COPY A CELL IT COPIES THE ENTIRE TEXT BOX.

IS THERE ANYWAY I CAN COPY THE CELL CONTENTS THROUGH A MACRO FOR PASTING ON A WORD DOCUMENT OR ANY OTHER TEXT FILE WITHOUT ANY CONTROL CHARACTERS.

APARNA
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
This has been posted a few times, but generally does the trick with whatever modifications you need. Assumes your data starts in A1.
Good luck.
Code:
Sub AutomateWord()
Dim WordApp As Object, MySaveName As String
MySaveName = "c:\Temp\MyTestDocument.doc"
Set WordApp = CreateObject("word.application")
WordApp.Visible = True
    With WordApp
        .Documents.Add
        With .Selection
            .typetext Text:="The Header"
            .typetext Text:=vbLf & vbLf
            Range("a1").Select
            Do Until ActiveCell = vbNullString
                .typetext Text:=ActiveCell.Text & " "
                ActiveCell.Offset(1, 0).Select
            Loop
        End With
    .activedocument.SaveAs FileName:=MySaveName
    '.ActiveWindow.Close
    End With
    'WordApp.Quit
    Set workapp = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top