Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.automation,microsoft.public.word.programming,microsoft.public.word.vba
|
|||
|
|||
generating report from excel, trouble with bookmark..
Hi all,
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 that also doesn't work. I don't know what I am doing wrong. 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").Range("PROJECT_NAME").V alue Set phook = ThisWorkbook.Sheets("DOC").Range("DRAWING_LOC") Set pdCell = ThisWorkbook.Sheets("DOC").Range("PAD_DESCRIPTION" ) Set oDoc = oWrd.Documents.Open("U:\proj446\DocTemplate.dot") oDoc.Bookmarks("ProjName").Range.Text = proj Set ToCell = oDoc.Bookmarks("PadHook").Range Set TableCell = oDoc.Bookmarks("PdTable").Range With Worksheets("DOC") .Range(phook).Copy Destination:=ToCell .Range(pdCell, pdCell.End(xlDown).End(xlToRight)).Copy Destination:=TableCell End With oDoc.SaveAs CurDir & "\test.doc" oDoc.Close End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 Solver Internal Error When Generating Answer Report | Excel Discussion (Misc queries) | |||
hOW TO CREATE A BOOKMARK IN EXCEL+ | Excel Worksheet Functions | |||
Generating a report | Excel Worksheet Functions | |||
Generating a report list and statistic worksheet in Excel from other workbooks | Excel Discussion (Misc queries) | |||
Trouble making a report of all Files within a Folder and all Subfolders? | Excel Programming |