
Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
>I developed a macro in Word 97. It performs as expected in 97 but doesn't
> quite run correctly in Word 2003. The code is in a For Loop (there are a
[quoted text clipped - 11 lines]
> Thanks
> Glenn
Doug,
Are there particular options that I should set?
Also, here's the top level code
Sub Male_HemoChem_1_Table_6_Dose()
'
' Male_HemoChem_1_Table_6_Dose Macro
' Macro recorded 10/21/05 by Glenn Simmons
'
Dim i As Integer
If ASI_6_Dose.TextBox1.Text = "" Then
MsgBox "Enter Starting Table Number", vbCritical, "Error"
End If
If ASI_6_Dose.TextBox2.Text = "" Then
MsgBox "Enter Ending Table Number", vbCritical, "Error"
End If
If CInt(ASI_6_Dose.TextBox1.Text) > CInt(ASI_6_Dose.TextBox2.Text) Then
MsgBox "Starting Table Number Must Be Less Than Ending Table Number",
vbCritical, "Error"
End If
If ActiveDocument.PageSetup.Orientation = wdOrientPortrait Then
Application.Run MacroName:="Page_SetUp"
End If
For i = 1 To (CInt(ASI_6_Dose.TextBox2.Text) -
CInt(ASI_6_Dose.TextBox1.Text)) + 1
Selection.Find.ClearFormatting
With Selection.Find
.Text = "¦^wIn Female"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
End With
Selection.Find.Execute
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Application.Run MacroName:="Male_HemoChem_RemoveFemale_6_Dose"
Application.Run MacroName:="HemoChem_Format_6_Dose"
Selection.HomeKey Unit:=wdLine
Selection.MoveUp Unit:=wdLine, Count:=6
Application.Run MacroName:="Look_6_Dose"
Next i
End Sub
> Without seeing the code, the only thing to suggest is that in Word 2003, you
> set the Compatability Options to Word 97 under Tools>Options>Compatability
[quoted text clipped - 14 lines]
> > Thanks
> > Glenn
Glenn - 12 Nov 2005 14:19 GMT
I meant to add that when I process the block of text by itself, everything
happens as it should. I originally thought that there might be something out
of whack with the text itself, but the problem doesn't appear to have
anything to do with the text being processed.
Here is sort of what the text looks like before it's processed.
+-------------------------------------------------------------------------+
¦ ALBUMIN ¦ ALBUMIN
¦
¦ IN MALE F344/N RATS ¦ IN FEMALE F344/N RATS ¦
¦ (22 DAYS) ¦ (22 DAYS)
¦
¦------------------------------------+------------------------------------¦
¦DOSE RATIO ¦DOSE RATIO ¦
¦mg/L NUMBER MEAN S.E. (a) ¦mg/L NUMBER MEAN S.E. (a) ¦
¦------------------------------------+------------------------------------¦
¦ ¦ ¦
¦ 0 10 4.280 0.065 - ¦ 0 10 4.660 0.052 - ¦
¦ 125 10 4.450 0.043 104 ¦ 125 10 4.650 0.034 100 ¦
¦ 250 10 4.300 0.047 100 ¦ 250 10 4.690 0.084 101 ¦
¦ 500 10 4.330 0.045 101 ¦ 500 10 4.530 0.033 97 ¦
¦ 1000 10 4.330 0.030 101 ¦ 1000 10 4.710 0.046 101 ¦
¦ 2000 10 4.380 0.036 102 ¦ 2000 10 4.560 0.070 98 ¦
¦ ¦ ¦
¦------------------------------------+------------------------------------¦
¦TREND(b) + (P=0.711) ¦TREND(b) - (P=0.418) ¦
¦TEST USED(c) Dunn ¦TEST USED(c) Dunn ¦
+-------------------------------------------------------------------------+
Here is approximately what it should look like after being macroed
ALBUMIN
¦ IN MALE F344/N RATS
¦ (4 DAYS)
¦------------------------------------
Dose 0 125 250 500 1000 2000
n 10 10 10 10
3.970 0.073 3.980 0.084 9 3.878 3.920 0.101 9 4.022 4.080 0.099
4.0 ± 0.1 4.0 ± 0.1 9.0 ± 3.9 3.9 ± 0.1 9.0 ± 4.0 4.1 ± 0.1
Here is the problem text
-------------------------------------------------------------------------+
¦MCV
¦ IN MALE SPRAGUE DAWLEY RAT
¦ (4 DAYS)
¦------------------------------------ 336
Dose 0 125 250 500 1000 8
n 10 59.060 0.357 59.030 0.389 58.560 0.311 59.300 0.243 .9300. 100
¦ 2000 10 58.510 0.230 99
For some reason, it's not removing the ¦ at the end of two lines, which
throws off processing the table. Like I said, if I process the table by
itself, it works fine.
Glenn
> Doug,
>
[quoted text clipped - 65 lines]
> > > Thanks
> > > Glenn