Hi friends,

I want to copy few cells of an excel sheet and paste special(picture) in ms-word. I want to develop a vb code code for this.

Please help!...

Regards,
Dinil

Do u want to write this code :

a) from within an Excel file in VBA Editor?

OR

b) from within Word file in VBA Editor?

OR

c) from VISUAL BASIC IDE?


Regards
Shaik Akthar

I want to write this code from VISUAL BASIC IDE.

Regards,
Dinil

Hi,

Try This Code:

Dim exel As Object
Dim WBEx As Object
Dim ExelWS As Object
Dim appwd As Object

Set exel = CreateObject("Excel.Application")
Set WBEx = exel.Workbooks.Open("C:\Myexce.xls")
Set ExelWS = WBEx.Worksheets("Sheet1")
Set appwd = CreateObject("Word.Application")
appwd.Visible = True
appwd.Documents.Open FileName:="C:/doc1.doc"
ExelWS.Range("A1:D20").Select
Selection.Copy
appwd.Selection.PasteSpecial Placement:=wdInLine, DataType:=wdPasteMetafilePicture
appwd.Documents.Save
Set appwd = Nothing
Set ExelWS = Nothing
Set WBEx = Nothing
Set exel = Nothing

Change your range selection accordingly..

Regards
Veena

Thanks a lot.....
Its done...

Regards,
Dinil

Hi Shaik,

Could you pls tell the similar code for VBA.

Thanks in advance.

Regards,

Vijay

I request to Veena also for VBA code :)

Regards,

Vijay

Hi friends

I need to a vb code under ms word that copy from a specifice cell in excell and past the value in ms word in a bookmark (field).

can you help
by the way i am using ms word 2003

many thanks,

khuraidah

Hi,

Try This Code:

Dim exel As Object
Dim WBEx As Object
Dim ExelWS As Object
Dim appwd As Object

Set exel = CreateObject("Excel.Application")
Set WBEx = exel.Workbooks.Open("C:\Myexce.xls")
Set ExelWS = WBEx.Worksheets("Sheet1")
Set appwd = CreateObject("Word.Application")
appwd.Visible = True
appwd.Documents.Open FileName:="C:/doc1.doc"
ExelWS.Range("A1:D20").Select
Selection.Copy
appwd.Selection.PasteSpecial Placement:=wdInLine, DataType:=wdPasteMetafilePicture
appwd.Documents.Save
Set appwd = Nothing
Set ExelWS = Nothing
Set WBEx = Nothing
Set exel = Nothing

Change your range selection accordingly..

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.