Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.automation,microsoft.public.word.programming,microsoft.public.word.vba
external usenet poster
 
Posts: 33
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Solver Internal Error When Generating Answer Report Don S. Excel Discussion (Misc queries) 18 November 7th 12 07:33 PM
hOW TO CREATE A BOOKMARK IN EXCEL+ Padre310 Excel Worksheet Functions 0 March 26th 10 01:46 PM
Generating a report JerryS Excel Worksheet Functions 4 January 9th 06 04:44 PM
Generating a report list and statistic worksheet in Excel from other workbooks [email protected] Excel Discussion (Misc queries) 1 December 20th 05 04:13 PM
Trouble making a report of all Files within a Folder and all Subfolders? SuperJas Excel Programming 2 April 2nd 04 02:41 AM


All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"