Access Visual Basic References
-
We have an Access database that is used here at my company. We have references to Microsoft Word and Excel. The problem is that not everyone here at the company has the same version of Word and Excel. Everyone has been told that they should not be doing developing work in the database, but people still are because the references to the libraries keep getting updated to different versions. We already have people entering in a log in, is there any way that I can detect (using code) when references get changed? Then I could link it back to the user and find out who is developing when they should not be. Thanks for your help! Kogorman
-
We have an Access database that is used here at my company. We have references to Microsoft Word and Excel. The problem is that not everyone here at the company has the same version of Word and Excel. Everyone has been told that they should not be doing developing work in the database, but people still are because the references to the libraries keep getting updated to different versions. We already have people entering in a log in, is there any way that I can detect (using code) when references get changed? Then I could link it back to the user and find out who is developing when they should not be. Thanks for your help! Kogorman
No, your best best is to Code using "Late Binding" methods. All you have to do is get rid of your References when you are sure that the Code works, then Change every Variable to Type "Object". This way it will work no matter what Version of MS Office plus you can trap Errors to determine if Office is not installed. For example:
On Error Goto ErrHandler
Dim xlApp As Excel.Application 'Error will Occur here when not installed
Set xlApp = New Excel.ApplicationErrHandler:
If (Err.Number <> 0) Then
'Of course, determine the Correct Error Number for this...
MsgBox "Excel is not Installed!"
End IfNow, change it to this after removing all References to Excel:
On Error Goto ErrHandler
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application") 'Error will Occur here when not installedErrHandler:
If (Err.Number <> 0) Then
'Of course, determine the Correct Error Number for this...
MsgBox "Excel is not Installed!"
End If