Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2011, 12:23 PM
fogharty fogharty is offline Using macro to delete styles Windows 7 32bit Using macro to delete styles Office 2007
Novice
Using macro to delete styles
 
Join Date: Jul 2011
Posts: 4
fogharty is on a distinguished road
Default Using macro to delete styles

I'm working with documents where there are a lot of unused styles. I tried to record a macro using the organizer to delete unwanted styles, but I can't get it to work. I tried to edit it, and what I came up with is:

Application.OrganizerDelete Source:= _
"ActiveDocument" _
, Name:="body play", Object:=wdOrganizerObjectStyles

repeated for each style.

I'm thinking the "ActiveDocument" is the problem.

If I could get this to work, it would be better for my purposes than the usual things, copying and pasting in a new template, etc.

This is in Word 2007.
Reply With Quote
  #2  
Old 10-10-2011, 03:42 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Using macro to delete styles Windows 7 64bit Using macro to delete styles Office 2010 32bit
Moderator
 
Join Date: Aug 2011
Posts: 3,907
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default Source parameter...

The Source parameter must specify the name and path of the document or template containing the style you want to delete. For example, if the style is in the Normal template, you can use the following:

Code:
 
Application.OrganizerDelete _
Source:=NormalTemplate.FullName, _
Name:="style name here", _
Object:=0
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using macro to delete styles Macro to delete all empty rows from all tables braddgood Word VBA 15 10-02-2015 01:54 PM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM
Using macro to delete styles Help with styles please :( ihmemies Word 1 06-04-2011 05:04 AM
delete email message via blackberry and have it delete on my pop3 and my outlook Iamthestorm Outlook 2 10-28-2010 12:21 AM
Automated "Macro" to delete Tags/Anchors field3 Word VBA 0 02-25-2009 02:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:51 PM.


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