Hello Fivewinners,
I have inserted a button in an Excel xls-File which invokes a Visual-Basic routine.
how can I invoke this routine cmdButton_Click() with ole?
best regards, Norbert
Hello Fivewinners,
I have inserted a button in an Excel xls-File which invokes a Visual-Basic routine.
how can I invoke this routine cmdButton_Click() with ole?
best regards, Norbert
Norbert,
I don't know if this will help but you can try to record a macro, then click your button. Now edit the macro and look at the code, it might give you an idea as to how to incoke from FW.
Jeff
Jeff Barnes wrote:Norbert,
I don't know if this will help but you can try to record a macro, then click your button. Now edit the macro and look at the code, it might give you an idea as to how to incoke from FW.
Jeff
Try recording a macro.
Then record another macro that runs the first macro.
Then debug code and you will find something like
Application.Run "Book1!Macro1"
Maybe this gives you a clue.
Gale FORd wrote:Try recording a macro.
Then record another macro that runs the first macro.
Then debug code and you will find something like
Application.Run "Book1!Macro1"
Maybe this gives you a clue.
Private Sub cmdCreateBeleg_Click()
If (bOLAnmeldung) Then
'MsgBox "Anmeldung erfolgreich"
bAngemeldet = True
End If
ReadCells
If bAngemeldet Then
bOk = bSetBelegKopf
bOk = bSetPositionen
bOk = bSaveBeleg
WriteErgebnis
Else
' MsgBox "Sie sind nicht an der Office Line angemeldet."
End If
Clear
End SubWhy not put the code that is now in cmdCreateBeleg_Click() in a macro.
Then call the macro from cmdCreateBeleg_Click(), and from external program.
Gale FORd wrote:Why not put the code that is now in cmdCreateBeleg_Click() in a macro.
Then call the macro from cmdCreateBeleg_Click(), and from external program.
Gale FORd wrote:Why not put the code that is now in cmdCreateBeleg_Click() in a macro.
Then call the macro from cmdCreateBeleg_Click(), and from external program.
function test()
oExcel := TOleAuto():New("Excel.Application")
oExcel:WorkBooks:Open( "H:\My Documents\test.xls" )
oExcel:Visible := .t.
oExcel:Run( "test.xls!Sheet1.CommandButton1_Click" )
return( .t. )Sub CommandButton1_Click()
MsgBox "Sie sind nicht an der Office Line angemeldet."
End SubGale FORd wrote:This works for me.function test() oExcel := TOleAuto():New("Excel.Application") oExcel:WorkBooks:Open( "H:\My Documents\test.xls" ) oExcel:Visible := .t. oExcel:Run( "test.xls!Sheet1.CommandButton1_Click" ) return( .t. )