Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
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
Inserting data into Word document by a range of dates from Excel spreadsheet Gordon[_6_] New Users to Excel 3 July 29th 08 08:22 PM
Inserting the Excel workgroup into word Rag742 Excel Discussion (Misc queries) 0 February 14th 07 09:35 PM
Problem inserting Excel data into Word Philamental Excel Discussion (Misc queries) 6 February 14th 06 11:47 AM
Inserting Photos into Excel and linking to Word. Uploading Photos Excel Discussion (Misc queries) 0 March 17th 05 08:05 PM
Inserting selected range into Word document Ed Stevens[_2_] Excel Programming 2 October 15th 03 03:35 PM


All times are GMT +1. The time now is 05:03 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"