• WSTroyWells

    WSTroyWells

    @wstroywells

    Viewing 15 replies - 76 through 90 (of 355 total)
    Author
    Replies
    • in reply to: Number format as bullet in a multilevel list (Word 2003) #1032137

      When I ran that command with the bullet I wanted selected, it gave me 8226.

      However, when I put that in the macro, it gave me those generic squares again.

      Let me attach what I have and maybe you can see where I’m missing it.

      Thanks!!
      Troy

    • in reply to: Number format as bullet in a multilevel list (Word 2003) #1032125

      I know I should know this, how did you find the number?

      It worked, but it put in the wrong bullet.

      I know there is a simple macro/function that would give me the number I needed for the ChrW based on a selection. Could you please provide it?

      I can get the symbol from the Symbols dialog, but I need the number.

      Thanks!!
      Troy

    • in reply to: Determining Row Height (Word 2003) #1029952

      Thanks to your fine example, I was able to come up with a script that is much faster (for a 300 page document with many tables it took 12 seconds compared to 6:45).

      Please don’t take that as a criticism. Yours is much more elegant, and I learned much from it. I just didn’t need it all.

      The following is my script:

      Sub GetHeightInInchesForTooBigRows()
      Dim intCounter As Integer
      Dim aTable As Table
      Dim I1 As Integer
      
      'This error statement handles rows with merged cells.
      On Error GoTo CombinedCellError
      GoTo AfterCombinedCellError
      CombinedCellError:
      If Err.Number = 5941 Then
          aTable.Rows(I1).Select
          aTable.Cell(I1, Selection.Columns.Count).Select
          Resume Next
      End If
      AfterCombinedCellError:
      Selection.HomeKey Unit:=wdStory
      
      For Each aTable In ActiveDocument.Tables
          For I1 = 1 To aTable.Rows.Count
              aTable.Cell(I1, aTable.Columns.Count).Select
              Selection.MoveRight
              Selection.MoveLeft
              If Selection.Information(wdVerticalPositionRelativeToPage) > 715 Then
                  Selection.Rows(1).AllowBreakAcrossPages = True
              End If
          Next I1
      Next aTable
      End Sub

      Thanks for your help!!
      Troy

    • in reply to: Determining Row Height (Word 2003) #1029832

      Sorry for the confusion. I am generating Word documents from RoboHTML and then trying to clean them up with VBA as much as possibly.

      As I said in my orignal post, in most cases I want to DISallow rows breaking across pages, but for very large rows, rows that would not show all the data especially, I want to allow it. I know how to turn it on and off in VBA, but I just don’t know how to tell how big the row is to tell whether it is too big t shw everything.

      Now, thanks to this error, of all things, I am able to detect rows that are too big. I have attached the text of my finished module. Most of it is the same as what you gave. I just added my error routine and a line to delete the added temp row.

      Thanks again for your help!!
      Troy

    • in reply to: Determining Row Height (Word 2003) #1029815

      (Edited by TroyWells on 22-Sep-06 00:42. )

      Thanks for this great example!! However, I had the following errors:

      1. When I tried to paste the text into a module a got the following error:

      “Compile error: Syntax error”

      The problem seems to be with the first line:

      Attribute VB_Name = "modLounge20060919"

      What does this line do?

      2. If I commented out that line, the function works fine until it gets to a row that is too big to be seen. At that point, it gives the following error:

      Run-time error ‘4198’: Command failed

      It is failing at the following line:

      rngTemp.Rows.DistributeHeight

      If I delete enough text out of that row so that it is entirely visible, it works fine.

      Obviously, this defeats the purpose of the function since it is needed to measure the height of rows that are larger than the page.

      Any ideas?

      Thanks!!
      Troy
      ——————————-EDIT
      P.S. ACTUALLY, THIS SOLUTION WILL WORK FOR ME, but probably not for others who need to really know the height of this row.

      For me, all I need to do is create an “on error” statement where if the error number is 4198, I change the selected row to allow it to break across pages.

      What do you think?

    • in reply to: Determining if you are in an end of row marker (Word 2003) #1029546

      Works great!! The help actually mentions a couple of things. The syntax was actually different from the example.

      IsEndOfRowMark Property
      See AlsoApplies ToExampleSpecificsTrue if the specified selection or range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.

      Note This property is the equivalent of the following expression:

      Selection.Information(wdAtEndOfRowMarker)

      Example
      This example collapses the selection and selects the current row if the insertion point is at the end of the row (just before the end-of-row mark).

      Selection.Collapse Direction:=wdCollapseEnd
      If Selection.IsEndOfRowMark = True Then
          Selection.Rows(1).Select
      End If

      Either one of them works. I searched several ways in the help, but never found this topic.

      Thanks for the help!!
      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1028050

      OK. I can see that I would have to improve a lot to be clear as mud. Let me try.

      I have 1 listtemplate, called “mylisttemplate”. It uses the following styles/formats:

      Level 1 – paragraph style “style1” – Number format: “” (no number, just used to reset numbers on lower levels.)
      Level 2 – paragraph style “style2” – Number format: “” (no number, just used to reset numbers on lower levels.)
      Level 3 – paragraph style “style3” – Number format: “1.”
      Level 4 – paragraph style “style4” – Number format: “a.”
      Level 5 – paragraph style “style5” – Number format: “1)”

      No definitions beyond level 5 as I don’t use those in my lists.

      My situation:
      ——————————-
      1. List item 1.
      2. List item 2.
      (table that contains paragraph style “style1”. Because it contains style one, the next step restarts numbering at 1 instead of continuing a 3.

      Why does the table contain one of dummy styles, you might ask? Because the table contains two sets of substeps based on two alternative actions you could take in step 2. You could either take option 1 with sub-steps a. and b. or option 2 with sub-steps a. and b. I have to include paragraph style “style 1” to restart numbering within the table. Otherwise it would go: option 1 sub-steps a and b, then option 2 sub-steps c and d. Thus somewhere between option 1 and option two I put paragraph style “style 1” so the number restarts at the beginning of option 2. Unfortunately, this has the side effect of also restarting number in the list item immediately following the table. Thus…)

      1. List item 3.
      ——————————-

      Thus, my proposed solution is to use a second list template for all numbering that appears within tables. It would be a similar mylist template, except that I would use different dummy styles at the first two levels to restart numbering. For example:

      Level 1 – paragraph style “style6” – Number format: “” (no number, just used to reset numbers on lower levels.)
      Level 2 – paragraph style “style7” – Number format: “” (no number, just used to reset numbers on lower levels.)
      Level 3 – paragraph style “style8” – Number format: “a.”
      Level 4 – paragraph style “style9” – Number format: “1)”

      These should restart numbering on items within the table that use paragraph style “style 8 or 9” but leave list items that use the first list template and paragraph style “style 3”, “style 4” or “style 5” unchanged.

      At least that’s my theory. I’ll let you know how it turns out.

      Enjoy!!
      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027997

      Andrew,
      Thanks for your kind attention to my problem!!

      As far as why I need to reset numbering in the middle of a list, I have a single list template named “myListItems”. It is a multilevel list where the first two levels are “dummy” list items that are tied to specific styles that help numbering to restart at other levels.

      Thus my problem. When the styles appear, say in an if/then table in the middle of a list, and the list continues, it starts over at 1. I have to put some of those dummy styles in the table so I can restart substeps in the second if/then row of the table. I can manually change it to start at whatever I want, but I’d prefer to do it in a macro.

      Hey, I just had a thought. If I create a second list template and use the macro to apply that to the list items in these tables, will that list template interfere with numbering before and after the table if the numbering before and after the table use the other list template? If not, that may solve my problem. I could create a new “dummy” style to use in the if/then tables to reset numbering for the second and following if/then scenarios, and that dummy style should not restart items in my first list template since it will not appear in that template.

      What do you think, or did I lose you?

      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027605

      Stuart,
      I used the following:

      MsgBox Selection.Range.ListFormat.ListTemplate.Name

      on steps that had not been reset and on a step I manually reset. They both came back with the same name.

      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027595

      I have a single list template named “myListItems”. It is a multilevel list where the first two levels are dummy list items that are tied to specific styles that help it restart.

      Thus my problem. When the styles appear, say in a table, and the list continues, it starts over at 1. I can manually change it to start at whatever I want, but I’d prefer to do it in a macro.

      Any ideas would be appreciated!!

      Thanks!!
      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027501

      This code works in that it causes no error. The problem is that it causes all the lists in the entire document to start at whatever value is set here. In other words, if I want to change the startat value from “a” to “c”, all lists at that level in the entire document now start at “c”.

      Any other ideas?

      Thanks!!
      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027471

      Sorry, I guess I am not being clear. Nothing new for me.

      I am not trying to “return” anything. I am trying restart number at, for example, “3” for a list item that is currently set to start at “1”.

      How do I do that.

      Thanks!!
      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027453

      (Edited by TroyWells on 06-Sep-06 19:34. )

      I am trying to reset a list item number from 1 to 3 (or another number I calculate from a variable) in the middle of a list. Do to the dummy restart styles I have at the beginning of my list and how I have to use them, the numbers are restarting prematurely. Calculating the variable is no problem. Resetting the number is. I have tried using the following code:

      Dim List1 As Long
      Dim ListNumberBefore as Integer

      Set List1 = ListGalleries(wdOutlineNumberGallery).ListTemplates(Selection.Range.ListFormat.ListTemplate.Name).ListLevels(Selection.Range.ListFormat.ListLevelNumber)
      With List1
      .StartAt = ListNumberBefore + 1
      End With

      However, I get the following error:

      Compile error. Object required.

      Please advise what I am doing wrong or if there is a better way.

      Thanks!!
      Troy

    • in reply to: Resetting a number in the middle of a list (Word 2003 VBA) #1027458

      Sorry!! I did not name that variable well at all.

      The ListLev variable is actually the list. I will edit my original post and rename to “List1”. I was trying to follow an example I found in the online help by setting this.

      Sorry for the confusion, and please help!!

      Thanks!!
      Troy

    • I’ll double-check the “not closing properly” theory, but I am pretty sure I ruled that out in the past.

      Where it the registry would I find a policy that would override this?

      Thanks for the help!!
      Troy

    Viewing 15 replies - 76 through 90 (of 355 total)