What line is the error on?
Maybe Get_County() is not defined?
"LorrdWolf" <=?utf-8?B?TG9ycmRXb2xm?=> wrote in message
news:db46b589-9dc8-407c-9a21-404bd195d70f...
I am trying to write some modular code for my company so that I do not have
to constantly add the same code to my macros. In this case, I need to pull
the name of a county from our database. The GetCounty module does that but
when I try to compile this macro, I get this "COMPILE ERROR: Sub or Function
not defined". My code is below
Sub AutoOpen()
'
Application.VBE.ActiveVBProject.VBComponents.Import "U:\Jason
Bennett\Work\Macro Files\clsDatabase.cls"
Application.VBE.ActiveVBProject.VBComponents.Import "U:\Jason
Bennett\Work\Macro Files\GetCounty.bas"
' Declaring variables.
Dim strFileNumber As String
' Getting the file number.
strFileNumber = InputBox("What is our file number? XX-XXXXX.", "FILE
NUBMER")
' Calling the function to get the county name.
strCounty = Get_County(strFileNumber)
MsgBox "The county is " & strCounty, vbOKOnly, "COUNTY NAME TEST"
' Removing the modules.
Application.VBE.ActiveVBProject.VBComponents.Remove
End Sub
Any help would be greatly appreciated.