Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-20-2014, 06:53 AM
kennethc kennethc is offline Error when using customised button Windows XP Error when using customised button Office 2003
Novice
Error when using customised button
 
Join Date: Sep 2010
Posts: 23
kennethc is on a distinguished road
Default Error when using customised button

I have a customised button in Word 2010 and when you click on it, you get a list of options. One of those is to insert a table of contents.
I have created this using Custom UI Editor, as follows:

<button id="rxbtnStylesInsertTOC"


label="Insert TOC"
showLabel="false"
image="TOC"
supertip="Insert TOC at the current location in the document."
onAction="plctoc"/>

The callback is as follows:

'Callback for rxbtnStylesInsertTOC onAction
Sub plctoc(control As IRibbonControl)
End Sub

I recorded the macro and the code is as follows:
Sub plctoc()
'
' plctoc Macro
'
'
With ActiveDocument
.TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _
LowerHeadingLevel:=1, IncludePageNumbers:=True, AddedStyles:="", _
UseHyperlinks:=True, HidePageNumbersInWeb:=True, UseOutlineLevels:= _
True
.TablesOfContents(1).TabLeader = wdTabLeaderSpaces
.TablesOfContents.Format = wdIndexIndent
End With
End Sub

When I click on the button to run the insert table of contents I get the following error:

"Wrong number of arguments or invalid property assignment"

What am I missing or where have I fallen short, all suggestions greatly received.

Many thanks.

Kenneth
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when using customised button Convert customised endnotes to automatic amnew Word 6 06-04-2013 11:47 PM
Error when using customised button Deploying customised toolbars kennethc Word 1 02-11-2012 01:18 PM
Project 2010 Customised Lookup Fields OTPM Project 0 07-26-2011 11:10 AM
Error when using customised button Customised style set Sonja Word 3 05-09-2011 03:30 PM
Mail merge with customised subject mohanss Mail Merge 0 06-26-2010 10:14 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft