![]() |
Reposting to get your kind attention
Hi all,
I have been trying two weeks to find a solution to this problem. I have posted this in 6+ groups. Unfortunately, I am not able to get some attention to this problem. I am reposting this again, just incase if someone finds this problem interesting....Thanks for your kind attention... The original problem is as below... I am trying to generate couple of word documents from excel sheet. I start with word template file with enclosing bookmarks to insert text and objects from excel. I have to add three things to the word document. 1. project name 2. pad drawing 3. table of data I am able to successfully replace the bookmarks when I use text. But when I try to copy the drawing(a picture), it doesn't work. Also I try to copy a table and that doesn't work. I don't know what I am doing wrong. Or do you have a better suggestion. The code is shown below. Thanks in advance for correcting me with your suggestions. shishi Sub GenerateDocs() Dim oWrd As Word.Application Dim oDoc As Word.Document Set oWrd = New Word.Application oWrd.Visible = False proj = ThisWorkbook.Sheets("DOC").Ran**ge("PROJECT_NAME") .Value Set phook = ThisWorkbook.Sheets("DOC").Ran**ge("DRAWING_LOC") Set pdCell = ThisWorkbook.Sheets("DOC").Ran**ge("PAD_DESCRIPTIO N") Set oDoc = oWrd.Documents.Open("U:\proj44**6\DocTemplate.dot" ) oDoc.Bookmarks("ProjName").Ran**ge.Text = proj Set ToCell = oDoc.Bookmarks("PadHook").Rang**e Set TableCell = oDoc.Bookmarks("PdTable").Rang**e With Worksheets("DOC") .Range(phook).Copy Destination:=ToCell .Range(pdCell, pdCell.End(xlDown).End(xlToRig**ht)).Copy Destination:=TableCell End With oDoc.SaveAs CurDir & "\test.doc" oDoc.Close End Sub |
All times are GMT +1. The time now is 02:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com