Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 01-10-2012, 08:24 PM
macropod's Avatar
macropod macropod is offline Loop through listboxes in Application.OrganizerCopy Windows 7 64bit Loop through listboxes in Application.OrganizerCopy Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,342
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Yes, they are built-ins, but clearly they don't account for all built-in Styles. An error trap is exactly what I used to generate the list. What I haven't been able to figure out yet is why those particular Styles generate an error, but the other built-ins etc don't. if you're happy with an error report, try:
Code:
Private Sub CmdCopyStyle_Click()
Dim DestDoc As String, x As Long, y As Long, StrSty As String, StrList As String
For x = 0 To ListBox3.ListCount - 1
  DestDoc = ListBox3.Column(0, x)
  For y = ListBox2.ListCount - 1 To 0 Step -1
    StrSty = ListBox2.Column(0, y)
    On Error Resume Next
    Application.OrganizerCopy Source:=SourceFile, Destination:=DestDoc, _
      Name:=StrSty, Object:=wdOrganizerObjectStyles
    If Err.Number = 4198 Then
      If x = 0 Then StrList = vbCr & StrSty & StrList
      ListBox2.RemoveItem (y)
    End If
    Err.Clear
  Next y
Next x
If StrList <> "" Then MsgBox "Unable to copy the following Styles:" & StrList
End Sub
After the first pass, all the errant Styles will have been deleted from the 'Selected Styles' box and, on completion (after the error report), only the copied Styles will remain there.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use for loop in formula in VBA? tinfanide Excel Programming 1 12-06-2011 08:33 AM
music loop in powerpoint presentation genoMU69 PowerPoint 1 06-15-2011 08:00 AM
While loop not working right Cbrehm Excel Programming 0 05-11-2011 11:05 AM
Loop through listboxes in Application.OrganizerCopy Continuous Loop cksm4 Word 6 01-06-2011 09:03 PM
Outlook 2003 restart in a loop Stegel Outlook 0 06-29-2007 12:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:58 PM.


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