Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Excel Range into Word
I have an excel workbook that performs assorted calculations. I am then
pasting the final output into an existing Word Document. Now I have been able to open the word doc, find the text to insert the excel object in front of. But it always leaves the text I searched for highlighted. I have not been able to delete this text though. So I really would like to open word, search for text, and REPLACE the text with an OBJECT from excel. I don't mind inserting then deleting if need be. Set objword = CreateObject("word.application") objword.Visible = True Set objdoc = objword.documents.Open("c:\Work.doc") Set objselection = objword.Selection objselection.Find.Text = "All products and services sold are to be listed HERE." objselection.Find.Forward = True objselection.Find.matchwholeword = True If objselection.Find.Execute Then MsgBox ("Adding to Scope of Work Document") objword.Selection.PasteSpecial link:=False, DataType:=wdPasteObject, Placement:=wdInLine, DisplayAsIcon:=False Else MsgBox ("Unable to Modify Scope of Work Document") End If This part works. But how do I get rid of the text which is actually just a placeholder? -- Thanks, Craig |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Excel Range into Word
If objselection.Find.Execute Then
MsgBox ("Adding to Scope of Work Document") 'Delete the found text 'Leaves objselectrion a single point in your document objselection.Delete objword.Selection.PasteSpecial link:=False, DataType:=wdPasteObject, Placement:=wdInLine, DisplayAsIcon:=False Etc. -EW |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Excel Range into Word
Eric,
Excellent, that worked! I figured there had to be a simple way. -- Thanks, Craig "Eric White" wrote: If objselection.Find.Execute Then MsgBox ("Adding to Scope of Work Document") 'Delete the found text 'Leaves objselectrion a single point in your document objselection.Delete objword.Selection.PasteSpecial link:=False, DataType:=wdPasteObject, Placement:=wdInLine, DisplayAsIcon:=False Etc. -EW |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting data into Word document by a range of dates from Excel spreadsheet | New Users to Excel | |||
Inserting the Excel workgroup into word | Excel Discussion (Misc queries) | |||
Problem inserting Excel data into Word | Excel Discussion (Misc queries) | |||
Inserting Photos into Excel and linking to Word. | Excel Discussion (Misc queries) | |||
Inserting selected range into Word document | Excel Programming |