Thanks for the reply. Actually I have exported to RTF using Stephen Lebans'
utility that embeds the output of Snapshot Format inside an RTF file and it
does show my vertical lines that were written using vba, but not those made
with the line drawing tool.
I tried your suggestion for horizontal lines but was only able to draw
double vertical lines. Basically, I want Rect1...Rect9 to draw only vertical
lines. And I'd like, say, Rect11 and Rect12 to only draw horizontal lines.
Now I'm just floundering around. I managed to draw a double vertical line
for Rect11 and just show a rectangle itself for Rect12.
Private Sub Report_Page()
Dim intRects As Integer
Dim intPageHeadHeight As Integer
Dim intPageFootHeight As Integer
Dim intRptHeadHeight As Integer
Dim intLineBottom As Integer
Dim intLeft As Integer
Dim intTop As Integer
Dim intWidth As Integer
On Error GoTo Report_Page_Error
intRptHeadHeight = Me.Section(1).Height
intPageHeadHeight = Me.Section(3).Height
intPageFootHeight = Me.Section(4).Height
'find the y point of the bottom of line
intLineBottom = (11 * 1440) - _
(intPageFootHeight) - _
1440 'replace 1440 with total top and bottom margins
For intRects = 1 To 9
intLeft = Me("Rect" & intRects).Left
intTop = Me("Rect" & intRects).Top
If [Page] = 1 Then
intTop = intTop + intRptHeadHeight
End If
Me.Line (intLeft, intTop)-(intLeft, intLineBottom)
Next
For intRects = 11 To 12
intWidth = Me("Rect" & intRects).Width
' If [Page] = 1 Then
' intWidth = intWidth + intRptHeadHeight 'no idea
' End If
Me.Line (intLeft, intTop)-(intLeft + intWidth, intLineBottom)
Next
Stephanie wrote:
Sorry for being cryptic. I can't use the line tool because lines drawn with
it don't export to RTF. So I need to use vba code to draw the lines.
Duane H. published code that I've used for vertical lines. I have
rectangles called Rect1 through Rect9. The code draws vertical lines from
the top, left-hand corner of the rectangles down from page header to footer.
But I can't seem to make horizontal lines with the code as well and would
appreciate coding help. Thanks:
Private Sub Report_Page()
Dim intRects As Integer
Dim intPageHeadHeight As Integer
Dim intPageFootHeight As Integer
Dim intRptHeadHeight As Integer
Dim intLineBottom As Integer
Dim intLeft As Integer
Dim intTop As Integer
On Error GoTo Report_Page_Error
intRptHeadHeight = Me.Section(1).Height
intPageHeadHeight = Me.Section(3).Height
intPageFootHeight = Me.Section(4).Height
'find the y point of the bottom of line
intLineBottom = (11 * 1440) - _
(intPageFootHeight) - _
1440 'replace 1440 with total top and bottom margins
For intRects = 1 To 9
intLeft = Me("Rect" & intRects).Left
intTop = Me("Rect" & intRects).Top
If [Page] = 1 Then
intTop = intTop + intRptHeadHeight
End If
Me.Line (intLeft, intTop)- _
(intLeft, intLineBottom)
Next
On Error GoTo 0
Exit Sub
Report_Page_Error:
Select Case Err
Case 2462 'no page header
intPageHeadHeight = 0
Resume Next
End Select
MsgBox "Error " & Err.Number & " (" & _
Err.Description & ") in procedure " & _
"Report_Page of VBA Document Report_Report1"
End Sub
Marshall Barton said:
You need to specify the right side of the rectangle. Perhaps
just:
intWidth = Me("Rect" & intRects).Width
. . .
Me.Line (intLeft,intTop)-(intLeft+intWidth,intLineBottom)