PC Review


Reply
Thread Tools Rate Thread

Copy Data From Excel Into a MSWord Document

 
 
dimm
Guest
Posts: n/a
 
      16th Mar 2008
Hi folks,

As a follow on to my previous question (Thanks again for the help)......I
want to copy and paste data from MS Excel into MS Word. Is this even possible
with VBA?

For example:

If I have text in cell B3, and I want to copy it into my MSWord document,
right justify it and format it to be Bold and Italic......then I want to
enter a space below this text in MS Word, and copy in the cell value from
cell A4 onto the next line of my Word document left justified?

Does that make sense....can I do this?
 
Reply With Quote
 
 
 
 
Mark Ivey
Guest
Posts: n/a
 
      16th Mar 2008
Jon Peltier has some really good information on this topic...

http://peltiertech.com/Excel/XL_PPT.html


Mark

"dimm" <(E-Mail Removed)> wrote in message
news:E314BA1C-AD78-4B32-BD2A-(E-Mail Removed)...
> Hi folks,
>
> As a follow on to my previous question (Thanks again for the help)......I
> want to copy and paste data from MS Excel into MS Word. Is this even
> possible
> with VBA?
>
> For example:
>
> If I have text in cell B3, and I want to copy it into my MSWord document,
> right justify it and format it to be Bold and Italic......then I want to
> enter a space below this text in MS Word, and copy in the cell value from
> cell A4 onto the next line of my Word document left justified?
>
> Does that make sense....can I do this?


 
Reply With Quote
 
dimm
Guest
Posts: n/a
 
      17th Mar 2008
Thankyou, that helps a lot, but I have another question. John gives a macro
example for pasting into word as below from Excel, but what if the user has
another instance of Word open apart from my file (myfile.doc).

How do I specify that myfile.doc should be selected instead of any other
open word document?


' Reference existing instance of Word
Set WDApp = GetObject(, "Word.Application")
' Reference active document
Set WDDoc = WDApp.ActiveDocument
' Reference active slide

' Copy the range
Selection.Copy

' Paste the range
WDApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, _
Placement:= wdInLine, DisplayAsIcon:=False

' Clean up
Set WDDoc = Nothing
Set WDApp = Nothing
End If

End Sub

"Mark Ivey" wrote:

> Jon Peltier has some really good information on this topic...
>
> http://peltiertech.com/Excel/XL_PPT.html

 
Reply With Quote
 
Mark Ivey
Guest
Posts: n/a
 
      18th Mar 2008
Jon may be able to answer that question better than me...

Mark

"dimm" <(E-Mail Removed)> wrote in message
news:358D8797-ABCF-45CF-A05E-(E-Mail Removed)...
> Thankyou, that helps a lot, but I have another question. John gives a
> macro
> example for pasting into word as below from Excel, but what if the user
> has
> another instance of Word open apart from my file (myfile.doc).
>
> How do I specify that myfile.doc should be selected instead of any other
> open word document?
>
>
> ' Reference existing instance of Word
> Set WDApp = GetObject(, "Word.Application")
> ' Reference active document
> Set WDDoc = WDApp.ActiveDocument
> ' Reference active slide
>
> ' Copy the range
> Selection.Copy
>
> ' Paste the range
> WDApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, _
> Placement:= wdInLine, DisplayAsIcon:=False
>
> ' Clean up
> Set WDDoc = Nothing
> Set WDApp = Nothing
> End If
>
> End Sub
>
> "Mark Ivey" wrote:
>
>> Jon Peltier has some really good information on this topic...
>>
>> http://peltiertech.com/Excel/XL_PPT.html


 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      19th Mar 2008
I just did this yesterday:
http://www.microsoft.com/office/comm...r=US&sloc=&p=1

Clearly, you will have to customize it a little for your own situation, but
that should give you (most of) what you want.


Regards,
Ryan--

--
RyGuy


"Mark Ivey" wrote:

> Jon may be able to answer that question better than me...
>
> Mark
>
> "dimm" <(E-Mail Removed)> wrote in message
> news:358D8797-ABCF-45CF-A05E-(E-Mail Removed)...
> > Thankyou, that helps a lot, but I have another question. John gives a
> > macro
> > example for pasting into word as below from Excel, but what if the user
> > has
> > another instance of Word open apart from my file (myfile.doc).
> >
> > How do I specify that myfile.doc should be selected instead of any other
> > open word document?
> >
> >
> > ' Reference existing instance of Word
> > Set WDApp = GetObject(, "Word.Application")
> > ' Reference active document
> > Set WDDoc = WDApp.ActiveDocument
> > ' Reference active slide
> >
> > ' Copy the range
> > Selection.Copy
> >
> > ' Paste the range
> > WDApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, _
> > Placement:= wdInLine, DisplayAsIcon:=False
> >
> > ' Clean up
> > Set WDDoc = Nothing
> > Set WDApp = Nothing
> > End If
> >
> > End Sub
> >
> > "Mark Ivey" wrote:
> >
> >> Jon Peltier has some really good information on this topic...
> >>
> >> http://peltiertech.com/Excel/XL_PPT.html

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I import data from MSWord into Excel? How Please? Thank you TimH ! ! For the link ;-) JMH Microsoft Excel Misc 1 4th Dec 2009 10:59 PM
Copy-Pasting Excel Chart into Outlook default email editor (not MSWord) Robert Avery Microsoft Excel Programming 0 17th Aug 2009 08:45 PM
Copy data from PDF file to MSWORD(Without changing the color forma =?Utf-8?B?U0FXVEhFWUEgU0FXVEhFWUEgU0FXVEhFWUE=?= Microsoft Word Document Management 2 13th Jun 2007 11:51 AM
copy excel worksheet into msword with row, column headings and gr. =?Utf-8?B?ZWxlZGE=?= Microsoft Excel Misc 0 19th Jan 2005 01:31 AM
Replace Sorce of data in MSWord merge document MichaelK Microsoft Access External Data 3 30th Sep 2004 08:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:05 AM.