Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call a Module from Macro

Status
Not open for further replies.

Jorge555

Technical User
Oct 25, 2001
3
US
I have a macro that has a procedure to run a code and the function code is :

Option Compare Database
Public Function BackUpDB()

Dim oFiles As FileSystemObject
Dim strSource As String, strDest As String

strSource = "T:\Tech2001\Tech2001.mdb"
strDest = "C:\My Documents\backup\"

Set oFiles = New FileSystemObject

oFiles.CopyFile strSource, strDest, True

Set oFiles = Nothing

MsgBox "Back up succesful ", vbExclamation, "BACK UP COMPLETED"


End Function

I get an error when I run the that says can't find the function name
What I'm doing wrong????
 
Hi!

I am assuming that you are using the RunCode Action in the macro. If so, the only times I have seen that error is when I have misspelled the function name, tried to call a procedure instead of a function, the function wasn't public(with the Public keyword and in a module, not in a form) and if the module has the same name as the function, or there is another function in another module with the same name.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Hi jebry ...
I did change the name of mudule different and the name of the procedure stayed the same and the macro worked,I had the procedure and the module named the same
Thanks..
Another question is on that procedure I want to be able to hace a progress bar while is backing up the mdb file.

Is there any way that I can add a code to that procedure???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top