ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copy from Excel to Word by macro with certain for (https://www.excelbanter.com/excel-discussion-misc-queries/71123-copy-excel-word-macro-certain.html)

wmax77

copy from Excel to Word by macro with certain for
 

Hi,
i need your help people:confused:

this is the code:
Sub ControlWord()
Dim appWD As Word.Application
Dim wddoc As Word.Document
Set appWD = CreateObject("Word.Application")
Set wddoc = appWD.Documents.Add


FinalRow = Sheets("Data").Range("A9999").End(xlUp).Row
For i = 2 To FinalRow
Sheets("Data").Range("A" & i).Copy
Destination:=Sheets("Template").Range("C4")
Sheets("Data").Range("B" & i & ":E" & i).Copy
Sheets("Template").Range("C10").PasteSpecial Transpose:=True
Sheets("Template").Range("A1:F15").CopyPicture
appWD.Selection.Paste

Next i
appWD.ActiveDocument.SaveAs Filename:="c:\File.doc"
appWD.ActiveDocument.Close
appWD.Quit
End Sub

i copy data from excel to word by certain format,the problem is that
the data in excel devided to groups (from "Data--Group and Outline" in
the menu).
how can i change this code to copy the data with groups?
And how can i copy the data without table but not as a Picture?


--
wmax77
------------------------------------------------------------------------
wmax77's Profile: http://www.excelforum.com/member.php...o&userid=31355
View this thread: http://www.excelforum.com/showthread...hreadid=511465



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com