LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with my code please. (Error: Object doesn't support this property or method)


HI

i got a piece of code that runs from excel it opens a word document
updates parts of the document then breaks the links between Word and
Excel and then saves it.

I now want to add a table of contents page to the word document. I have
set up the page that I what it to do. I recorded the code and got the
following.
Sub InsertTOC()



' There is a bookmark called "TOC" this line goes to this part of the
document

Selection.Goto What:=wdGoToBookmark, Name:="TOC"
With ActiveDocument.Bookmarks
..DefaultSorting = wdSortByName
..ShowHidden = False
End With
'Then it move to the right of it and then moves down a couple of lines
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
' Insert fields (TOC) onto the page
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"TOC ", PreserveFormatting:=True
End Sub


I copied the code and put it into my Excel VBA and ran it it comes with
Object doesn't support this property or method and highlights the first
line.

any ideas to get this to word?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=530410

 
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
runtime error 434, object does not support this method or property Janis Excel Discussion (Misc queries) 4 January 17th 08 04:10 PM
VBA error: "object doesn't support this property or method" Dave F Excel Discussion (Misc queries) 2 April 23rd 07 06:04 PM
Email error Object dosen't support this property or method Steved Excel Programming 10 August 31st 05 11:25 PM
Object doesn't support this property or method (Error 438) Kiran Excel Discussion (Misc queries) 1 July 12th 05 08:42 PM
Run Time Error 438 - Object doesn't support the property or method Paul Cottier Excel Programming 0 September 10th 04 01:27 AM


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

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

About Us

"It's about Microsoft Excel"