Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am running Office 2002.
I have Excel documents which "name" certain pages in a given Word document. I want the Excel document to cause Word to edit that document so it only consists of the named pages. My model for text deletion is selection.extend; selection.gotoend; selection.delete. I find that selection.extend does not work. e.g. This does not work: Set oWD = CreateObject("Word.Application") With oWD .Visible = True .Documents.Open Filename:="C:\foo.doc", ReadOnly:=True .Selection.Extend ' This is ineffective ' .Selection.ExtendMode = True ' This is also ineffective .Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="4" .Selection.Delete Unit:=wdCharacter, Count:=1 End With OTOH, this does work: Set oWD = CreateObject("Word.Application") With oWD .Visible = True .Documents.Open Filename:="C:\foo.doc", ReadOnly:=True .Run "ZapTOC" End With where ZapTOC in foo.doc is set as: Sub ZapTOC() Selection.Extend Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="4" Selection.Delete Unit:=wdCharacter, Count:=1 End Sub Can anyone here advise on such automation? -- Walter Briscoe |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Automating a copy from Excel to Word | Excel Programming | |||
Automating Excel from Word - How to Sort a Range of Cells | Excel Programming | |||
Automating import of Word tables into Excel | Excel Discussion (Misc queries) | |||
Automating Word from Excel | Excel Programming | |||
Real problems automating a mail merge | Excel Programming |