Sorry to put such a generic title, but I seem to be having a lot of different problems with a procedure note the “ISSUE #”s in the code as follows:
Public Sub AnalyzeNumbers_Bullets()
Dim DocThis As Document
Dim ExistingListFormat As String
‘Dim ExistingListLevel As Integer
Dim ExistingNumberStyle As String
Dim ExistingNumberFormat As String
Dim ExistingNumberStyleExample As String
Dim ExistingParagraphIndent As String
Dim ExistingListFormatParagraphIndentCombo As String
Dim ExistingListFormatParagraphIndentComboCount As Integer
Dim NewListFormat As String
Dim NewParagraphIndent As String
Dim iParCount As Integer
Dim J As Integer, K As Integer
Dim ExistingListFormatParagraphIndentComboInUse(499) As String
Set DocThis = ActiveDocument
ExistingListFormatParagraphIndentComboCount = 0
iParCount = DocThis.Paragraphs.Count
For J = 1 To iParCount
‘Ignore paragraphs in tables.
If DocThis.Paragraphs(J).Range.Information(wdWithInTable) = False Then
‘ISSUE #1: This following line of code ignored all paragraphs in the document, not just
‘Ignore Headings.
those who were using styles Heading 1 through Heading 9, which is what I intended.
If DocThis.Paragraphs(J).Range.Information(wdRefTypeHeading) = False Then
‘ISSUE #2: The following line of code is intended to make the variable “ExistingNumberStyle” equal to the .NumberStyle of the current paragraph. I’m sure there is a better way.
ExistingNumberStyle = DocThis.Paragraphs
(J).Range.ListFormat.ListTemplate.ListLevels.Item.NumberStyle
‘ISSUE #3: The following line of code is intended to make the variable “ExistingNumberFormat” equal to the .NumberFormat of the current paragraph. I’m sure there is a better way.
ExistingNumberFormat = DocThis.Paragraphs(J).Range.ListFormat.ListTemplate.ListLevels.Item.NumberFormat
If ExistingNumberStyle = “wdListNumberStyleArabic” Then ExistingNumberStyleExample = “1”
If ExistingNumberStyle = “wdListNumberStyleLowercaseLetter” Then ExistingNumberStyleExample = “a”
If ExistingNumberStyle = “wdListNumberStyleUppercaseLetter” Then ExistingNumberStyleExample = “A”
If ExistingNumberStyle = “wdListNumberStyleLowercaseRoman” Then ExistingNumberStyleExample = “i”
If ExistingNumberStyle = “wdListNumberStyleUppercaseRoman” Then ExistingNumberStyleExample = “I”
‘ISSUE #4: Each of the following 9 lines of code is intended to replace the text in quotes contained in the string “ExistingNumberFormat” with the text in the string “ExistingNumberStyleExample”. However, I get the following error: “Function call on left-hand side of assignment must return Variant or Object.”
‘find #%within the string.
Replace(ExistingNumberFormat, “1%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “2%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “3%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “4%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “5%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “6%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “7%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “8%”, ExistingNumberStyleExample) = ExistingListFormat
Replace(ExistingNumberFormat, “9%”, ExistingNumberStyleExample) = ExistingListFormat
‘ISSUE #5: The following line of code is intended to make the variable “ExistingParagraphIndent” equal to left indent of the current paragraph. I’m getting a type mismatch error.
DocThis.Paragraphs(J).LeftIndent = ExistingParagraphIndent
ExistingListFormatParagraphIndentCombo = ExistingListFormat & “,” & ExistingParagraphIndent
For K = 1 To ExistingListFormatParagraphIndentComboCount
ExistingListFormatParagraphIndentComboCount = K
ExistingListFormatParagraphIndentComboInUse(ExistingListFormatParagraphIndentComboCount) = _
ExistingListFormatParagraphIndentCombo
‘Create a row of labels for this ExistingListFormatParagraphIndentCombo.
I realize this is only part of my procedure, but the procedure itself is not finished. I appreciate your help with these varied issues!!
Troy