I have this function i found for VB5 or VB6 but it doesn't seem to
want to work in VBA. As I am not to familiar with VBA and thoguht
they were interchangable can anyone help me with the function and
tell me the simple thign i am over looking to making it a VBA
function?
Public Function StopService(ServiceName As String) As Boolean
Dim oSysInfo As New ActiveDs.WinNTSystemInfo
Dim oComp As ActiveDs.IADsComputer
Dim oSvcOp As ActiveDs.IADsServiceOperations
Dim sCompName As String
Dim sSvc As String
Dim lRet As Boolean
On Error GoTo errorhandler:
sSvc = ServiceName
sCompName = "WinNT://" & _
oSysInfo.ComputerName & ",computer"
Set oComp = GetObject(sCompName)
Set oSvcOp = oComp.GetObject("Service", sSvc)
oSvcOp.Stop
StopService = True
Exit Function
errorhandler:
StopService = False
End Function