PDA

View Full Version : Call vba function from flash embedded in excel



RegiProf
06-22-2009, 04:44 AM
Hi guys,

RegiProf
06-22-2009, 04:56 AM
Hi guys,

Itīs my first post here and anywhere, so mind me the introduction:
I am a programmer for 5 years, started off with vba, then migrated to php, javacsript, actionscript, and a few other languages too. Nowadays I often create applications that use various languages simultaneously and pass variables between them.

I always found the solutions to my problems in existing threads all over the internet, but this time I just canít figure it out.

So here is the challenge:

I want to insert a flash file into an excel worksheet (embedded or loaded in). Basically this flash file contains a button (it may contain more buttons later). When I press the button on the flash file, I want to execute a function within the vba code.

I can insert a flash file into excel, no problem, through the shockwave Flash Object control.

I use this code in the flash file to trigger the button press:

on(release) {
www.text="aaa";
fscommand("messagebox", "This is a message box called from within Flash.");
}

In the receiving end (excel vba) I have de following code:

Private Sub mybutton_FSCommand(ByVal command As String, ByVal args As String)
MsgBox (args)
End Sub

When I press the flash button, I should get a msgbox displayed in excel sheet. But it doesnít work. Any ideas, guys?

Help would be much appreciated.


Here is the example worksheet and flash source: