Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2012, 12:42 AM
tinfanide tinfanide is offline Strange VBA ListTemplate ListLevel Problem Windows 7 64bit Strange VBA ListTemplate ListLevel Problem Office 2010 32bit
Expert
Strange VBA ListTemplate ListLevel Problem
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Strange VBA ListTemplate ListLevel Problem

Starters.xlsm
Starters.docx

The strange problem is there are 5 table cells, but the listlevel stops at 4 and restarts from 1.

Please take a look at the codes (quite long)
Just focus on "ReadingPart5Table" (Search it and go to it)
The codes before ReadingPart5Table are okay
And for details, please see the attached files (see the comments on the codes)

Please take a look at it if you are interested.


Many thanks in advance.
Reply With Quote
  #2  
Old 02-19-2012, 07:35 PM
macropod's Avatar
macropod macropod is offline Strange VBA ListTemplate ListLevel Problem Windows 7 64bit Strange VBA ListTemplate ListLevel Problem Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,341
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

Hi tinfanide,

Your document is empty, so I have no idea what the details about the issue are.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-20-2012, 01:27 AM
tinfanide tinfanide is offline Strange VBA ListTemplate ListLevel Problem Windows 7 64bit Strange VBA ListTemplate ListLevel Problem Office 2010 32bit
Expert
Strange VBA ListTemplate ListLevel Problem
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Yes, the document docx is empty. It's normal. I just use it for the xlsm file.
You can open a new document from Excel (xlsm) you like.
So please take a look at the commented codes in xlsm (Module Starters)


Code:
''' List Problem
''' Without this bit, the list starts from 1 To 5
''' With this bit, the list stops at 4 and restarts from 1
.Cell(arr(a), 2).Select
oWord.Keyboard (1033)
With oWord.ActiveWindow.Selection
.Range.Font.Underline = wdUnderlineDotted
.TypeText Text:=FindAndReturn("Reading", 5, 1, "Ques " & a, "Prefix") & " "
i = 0
Do
.TypeText Text:=ChrW(160)
i = i + 1
Loop Until i = 38
End With
'''
'''
Reply With Quote
  #4  
Old 02-20-2012, 02:15 AM
macropod's Avatar
macropod macropod is offline Strange VBA ListTemplate ListLevel Problem Windows 7 64bit Strange VBA ListTemplate ListLevel Problem Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,341
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

Hi tinfanide,

OK, so I've looked at the code - and run it - but I'm still none the wiser as to what the problem is, since there's no obvious problem in the output document. Your code indenting is all of the place, so reading it is difficult, and you haven't exactly given a lot of details ... I can't even be sure how many lines of code the 'this bit' refers to.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-20-2012, 02:50 AM
tinfanide tinfanide is offline Strange VBA ListTemplate ListLevel Problem Windows 7 64bit Strange VBA ListTemplate ListLevel Problem Office 2010 32bit
Expert
Strange VBA ListTemplate ListLevel Problem
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

http://youtu.be/lZL_GkOpFWM

Please watch the vid. I've pointed to the problem that confuses me. The list problem in Word. Why does it start a new list after the bullet point number 4?
Reply With Quote
  #6  
Old 02-20-2012, 08:47 PM
macropod's Avatar
macropod macropod is offline Strange VBA ListTemplate ListLevel Problem Windows 7 64bit Strange VBA ListTemplate ListLevel Problem Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,341
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

Hi tinfanide,

See attached. I've fixed the code - plus I declared a couple of undecalred variable and re-formatted the code for legibility. You would do well to manage your own code this way, as it makes the structure much easier to follow. The fix involved telling Word specifically whether to restart or continue the numbering. I also replaced a few unnecessary loops with Repeat statements.

Your code also contains numerous blocks of repeated procedures. These could be turned into one or two separate subs, which your main procedure would then call as needed. Your Word automation could also be made to un much faster by turning screen updating off for the duration of the document's update. Even more efficient would be to have all the required tables etc. in a template and, if the data changes, simply re-populate the relevant ranges with the required data.
Attached Files
File Type: xlsm TinfanideStarters.xlsm (82.9 KB, 17 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange VBA ListTemplate ListLevel Problem Strange problem with new font bkersh PowerPoint 1 07-06-2011 09:03 AM
Strange Word Document Problem. ookami Word 5 05-10-2011 02:26 AM
Strange VBA ListTemplate ListLevel Problem Strange Outlook startup problem Cec Britton Outlook 1 09-12-2010 10:14 AM
Strange VBA ListTemplate ListLevel Problem Strange wornways Forum Support 2 08-11-2010 06:34 PM
Strange VBA ListTemplate ListLevel Problem Strange problem with Word Revol Word 3 10-21-2009 10:32 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:44 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