Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


MS Word manipulation

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60297
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MS Word manipulation
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 MS Word manipulation - 5/16/2008 5:23:21 AM   
  alreginfo

 

Posts: 2
Score: 0
Joined: 5/16/2008
Status: offline
Hi,

I have a script I converted from VBA (the script does work in VBA) to VBScript.  It uses the Word object.  I am trying to apply new formatting to existing numbered lists in a document.  There may be more than one.  Everything appears to work except the actual application of the style.

Here's the existing code:

   For Each strList in objWord.ActiveDocument.ListParagraphs

   With objWord.ListGalleries(2).ListTemplates(1).ListLevels(1)
       .NumberFormat = "%1."
'        .TrailingCharacter = wdTrailingTab
       .TrailingCharacter = 2
'        .NumberStyle = wdListNumberStyleArabic
       .NumberStyle = 0
'        .NumberPosition = InchesToPoints(0.25)
       .NumberPosition = objWord.InchesToPoints(0)
'        .Alignment = wdListLevelAlignLeft
       .Alignment = 0
'        .TabPosition = InchesToPoints(0.5)
       .TabPosition = objWord.InchesToPoints(0.5)
'        .TextPosition = InchesToPoints(0.5)
       .TextPosition = objWord.InchesToPoints(0.5)
       .ResetOnHigher = 0
       .StartAt = 1
       .LinkedStyle = ""
   End With
  
   objWord.ListGalleries(2).ListTemplates(1).Name = ""
   objWord.Selection.Range.ListFormat.ApplyListTemplate objWord.ListGalleries(2).ListTemplates(1), 0, 0, 2


Here is the original VBA code for reference. 

With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
       .NumberFormat = "%1."
       .TrailingCharacter = wdTrailingNone
       .NumberStyle = wdListNumberStyleArabic
       .NumberPosition = InchesToPoints(0)
       .Alignment = wdListLevelAlignLeft
       .TextPosition = InchesToPoints(0.5)
       .TabPosition = InchesToPoints(0.5)
       .ResetOnHigher = 0
       .StartAt = 1
       .LinkedStyle = ""
   End With
   ListGalleries(wdNumberGallery).ListTemplates(1).Name = ""
   Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _
       wdNumberGallery).ListTemplates(1), ContinuePreviousList:=False, ApplyTo:= _
       wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior


Any thoughts on why the formatting won't apply?

- Al
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MS Word manipulation Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts