Run VBA code from Switchboard (1 Viewer)

ayjayh

Registered User.
Local time
Today, 22:43
Joined
Mar 29, 2002
Messages
20
Beginner needs help again.
I have written some vba code to do some external file handling and attached it to a button on a form. This all works fine.
However I really need to run this code from a button on my switchboard. I think I need to convert it somehow so I can use the "run code" option on the Switchboard Manager.
Do I need to convert it to a module or something? I would appreciate it if someone could spell it out for me.
Thanks in advance,
Tony
 

Rupert57

New member
Local time
Today, 22:43
Joined
Mar 23, 2002
Messages
6
>>>>>>>>>I have written some vba code<<<<<<<<<<

Is this in a module? If it is, it will have a name something like “Public Function msgConfirm()”

As long as it’s a public function you should be able to run it from the switchboard with the command “Run Code” you need to select this option from the “Edit switchboard item” screen, in the middle field named command. In the next field down, “Function Name” that’s where you type the name of the code you want to run, like:- “msgConfirm”.

A good tip is to type “XXXXXX” X’s in this field, then close the switchboard manager. Now open the table “Switchboard Items” look for your “XXXXXX” X’s and copy and paste your function name directly into this table.
 

ayjayh

Registered User.
Local time
Today, 22:43
Joined
Mar 29, 2002
Messages
20
Thanks for the reply Rupert and what you say sounds OK except that I can't seem to get my code into a Module! At present it exists as an Event Procedure in the On Click event of a button on one of my Forms.
I think if I could manage to insert this into a Module then the rest would fall into place.Just creating a new Module and then pasting the code into it doesn't seem to work.
Any advice on how to do this will be welcomed.
Tony

[This message has been edited by ayjayh (edited 06-03-2002).]

[This message has been edited by ayjayh (edited 06-03-2002).]
 

Rupert57

New member
Local time
Today, 22:43
Joined
Mar 23, 2002
Messages
6
I can’t understand why you can’t copy your code from a form module to a standard module. Try inserting the following code:-

Private Sub Testing()
‘Test Insertion
End Sub

See if that works, and it might be an idea to post a copy of your code here.
 

ayjayh

Registered User.
Local time
Today, 22:43
Joined
Mar 29, 2002
Messages
20
Thanks again Rupert, but I don't seem to be able to get the hang of the Module business. However, all is sorted now as I have dumped the Switchboard and constructed my own menu system with lots of lovely buttons to which I can easily attach VBA.
I'll catch up with the Module business in due course.
Thanks again
 

Users who are viewing this thread

Top Bottom