L
lk
Hi all,
I have the following problem.
I have a button executing VBA code (below) to print an array of worksheets.
This code has been working flawlessly, and has not been changed in any way.
However, after emailing the file to a user on another pc, the problem below
pops up.
Can anyone help?
Hi- am having a technical problem with this one- it won't print out. When I
hit the 'print invoice' button, a message pops up saying "compile error-
can't find project or library", and then visual basic pops up. I've pasted
in the script below. There should be an arrow pointing to the line " Private
Sub btnPrintInv_Click()
Private Sub btnPrintInv_Click()
'This procedure executes when the user clicks the Print Invoice button and
print 'previews all the invoice areas from Inv Summ to result 10.
frmWait.Show o
frmWait.Repaint
With Sheets(Array("Inv Summ", "Result 1", "Result 2", "Result 3", "Result
4", "Result 5", _
"Result 6", "Result 7", "Result 8", "Result 9", "Result
10"))
SetPrintAreasInv
frmWait.Hide
..PrintPreview
End With
Worksheets("Help").Activate
Worksheets("Inv Summ").Activate
Range("A1").Select
end sub
Sub SetPrintAreasInv()
'This procedure confirms that the print settings for each sheet are correct.
Application.ScreenUpdating = False
For Each Sheet In Sheets
If Sheet.Name = "Help" Or Sheet.Name = "Billing Rates" Or _
Sheet.Name = "Analysis" Or Sheet.Name = "Expense Schedule" Then
'Do nothing
Else
With Sheet.PageSetup
If .TopMargin <> Application.InchesToPoints(0.5) Then
.TopMargin = Application.InchesToPoints(0.5)
End If
.CenterHeader = ""
.BlackAndWhite = True
.PrintArea = "$A$1:$I$70"
If .CenterHeader <> "" Then .CenterHeader = ""
If .LeftFooter <> "&8Printed: &T on &D" Then .LeftFooter =
"&8Printed: &T on &D"
If .RightFooter <> "&8&F" Then .RightFooter = "&8&F"
If .LeftMargin <> Application.CentimetersToPoints(2.1) Then
.LeftMargin = Application.CentimetersToPoints(2.1)
End If
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End If
Next
Application.ScreenUpdating = True
End Sub
I have the following problem.
I have a button executing VBA code (below) to print an array of worksheets.
This code has been working flawlessly, and has not been changed in any way.
However, after emailing the file to a user on another pc, the problem below
pops up.
Can anyone help?
Hi- am having a technical problem with this one- it won't print out. When I
hit the 'print invoice' button, a message pops up saying "compile error-
can't find project or library", and then visual basic pops up. I've pasted
in the script below. There should be an arrow pointing to the line " Private
Sub btnPrintInv_Click()
Private Sub btnPrintInv_Click()
'This procedure executes when the user clicks the Print Invoice button and
print 'previews all the invoice areas from Inv Summ to result 10.
frmWait.Show o
frmWait.Repaint
With Sheets(Array("Inv Summ", "Result 1", "Result 2", "Result 3", "Result
4", "Result 5", _
"Result 6", "Result 7", "Result 8", "Result 9", "Result
10"))
SetPrintAreasInv
frmWait.Hide
..PrintPreview
End With
Worksheets("Help").Activate
Worksheets("Inv Summ").Activate
Range("A1").Select
end sub
Sub SetPrintAreasInv()
'This procedure confirms that the print settings for each sheet are correct.
Application.ScreenUpdating = False
For Each Sheet In Sheets
If Sheet.Name = "Help" Or Sheet.Name = "Billing Rates" Or _
Sheet.Name = "Analysis" Or Sheet.Name = "Expense Schedule" Then
'Do nothing
Else
With Sheet.PageSetup
If .TopMargin <> Application.InchesToPoints(0.5) Then
.TopMargin = Application.InchesToPoints(0.5)
End If
.CenterHeader = ""
.BlackAndWhite = True
.PrintArea = "$A$1:$I$70"
If .CenterHeader <> "" Then .CenterHeader = ""
If .LeftFooter <> "&8Printed: &T on &D" Then .LeftFooter =
"&8Printed: &T on &D"
If .RightFooter <> "&8&F" Then .RightFooter = "&8&F"
If .LeftMargin <> Application.CentimetersToPoints(2.1) Then
.LeftMargin = Application.CentimetersToPoints(2.1)
End If
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End If
Next
Application.ScreenUpdating = True
End Sub