
Originally Posted by
HoustonIT
Great tutorial orange, but 2010 is a different animal. When I select "OnClick", it brings me to the Macro Tools view with @ 20 options, but the ones that stick out the most are the runmacro and rundatamacro. I've typed MyPing into the macro box to run, but it fails with this:
Access was unable to locate the macro or VBA function. If you are trying to call a macro, make sure that the name of the macro and the name of the macro group are spelled correctly.
If you are trying to call a user-defined VBA function, be sure to use the following syntax:
=FunctionName() or =FunctionName(argument1,argument2,...)
Make sure that the function is either:
Defined in the code for the form or report.
- or -
A public function that is in a module (not a class module).
Change this a Sub procedure
Code:
Sub MyPing()
Dim x As String
x = "www.yahoo.com"
Shell "ping" & " " & x
End Sub
to this a Function where
IPAddr is the address you want to ping. The Address must be within double quotes.
Code:
Function MyPing(IPAddr as string)
If len(IPAddr) >0 Then
Shell "ping" & " " & IPAddr
else
MsgBox "Bad address was passed ....quitting"
End If
End Function
Glad you like the tutorial.
Give it a try.