View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JCanyoneer JCanyoneer is offline
external usenet poster
 
Posts: 56
Default ADO 2.7 & ADO 2.8 beforeprint

I have an excell workbook that I transfer information to access with. From
other threads, I have been told to check the Microsoft ActiveX data object
references to allow for the connection. I did this (using version 2.8). My
customer was getting errors from a hidden module so I had them search for the
latest version on their machine-2.7. I changed the references in my workbook
to 2.7 and now the macros run perfectly on there machine.

Now the problem. Since changing the version to 2.7, a macro that I use in
"This Workbook" to check for information from the user before printing does
not work. When printing, it is like the code in This Workbook is not even
there. Here's the code:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Header As String, Response As Integer, I As Integer
Header = Range("D2").Value
With ActiveSheet.PageSetup
.CenterHeader = "&12SI Body & Options" & Chr(10) & "APS Vehicle# " &
Header
End With
Response = MsgBox("Is this a Shop Copy or Office Copy? Click Yes for Shop
Copy, No for Office Copy, or Cancel to cancel printng", vbYesNoCancel)
If Response = vbYes Then
ActiveSheet.Unprotect ("123")
For I = 9 To 56
Range("E" & I).Select
Selection.ClearContents
Next I
Range("A1").Select
ActiveSheet.Protect ("123"), DrawingObjects:=True, Contents:=True,
Scenarios:=True, AllowFormattingCells:=True
End If

Any ideas why this is happening or what the simplest way to have this
workbook do all of the things I need?