Recreate Spreadsheet Look

  • Thread starter Thread starter DavidW
  • Start date Start date
D

DavidW

is there a way to recreate the spreadsheet look without exporting it to
excel?
I am trying to replicate a state form that we use, in the forms are boxes
like a spreadsheet, I can do that when there is data only, my problem is
that there are 24 lines or boxes that stay on the form, and if they are not
filled with info, they have to be visible. In the column on the left side in
the boxes are numbers 1-24 ascending for each line. Has anybody got an ideal
to work around this?
 
You may need to use the Line method to draw the lines. You will have total
control over where the lines are drawn. For instance, the following code
draws a calendar on a report page.

Private Sub Report_Page()
Dim lngDayHeight As Long
Dim lngDayWidth As Long
Dim datRptDate As Date
Dim intStartWeek As Integer
Dim lngTopMargin As Long
Dim dat1stMth As Date
Dim datDay As Date
Dim lngTop As Long
Dim lngLeft As Long
datRptDate = Date
dat1stMth = DateSerial(Year(datRptDate), Month(datRptDate), 1)
intStartWeek = DatePart("ww", dat1stMth)
lngDayHeight = 2160 'one & half inch
lngDayWidth = 1440 'one inch
lngTopMargin = 720 'half inch
Me.FontSize = 22
'loop through all days in month
For datDay = dat1stMth To DateAdd("m", 1, dat1stMth) - 1
'find the top and left corner
lngTop = (DatePart("ww", datDay) - intStartWeek) * _
lngDayHeight + lngTopMargin
lngLeft = (Weekday(datDay) - 1) * lngDayWidth
If Weekday(datDay) = 1 Or Weekday(datDay) = 7 Then
Me.DrawWidth = 8
Else
Me.DrawWidth = 1
End If
'draw a rectangle for day
Me.Line (lngLeft, lngTop)-Step _
(lngDayWidth, lngDayHeight), , B
Me.CurrentX = lngLeft + 50
Me.CurrentY = lngTop + 50
Me.Print Day(datDay)
Next
End Sub
 
Back
Top