Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 03-20-2014, 07:51 AM
Charles Kenyon Charles Kenyon is offline Error when using customised button Windows 7 64bit Error when using customised button Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Could you possibly attach (in a zip folder) the .dotm or .docm file with your customization and macro? Click (in this forum) on the Go Advanced button under the reply window.

Why not simply use the Insert Table of Contents command from Word commands rather than a macro? OK, I see, you just want level 1 headings.

I get an error message in the Custom UI when checking. May just be my typing.
Reply With Quote
  #3  
Old 03-20-2014, 09:46 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 Zipped template

Here you go, hopefully this helps?

Thanks.

Kenneth
Attached Files
File Type: zip PLC - Copy.zip (218.3 KB, 8 views)
Reply With Quote
Reply

Thread Tools
Display Modes


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 07:14 AM.


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