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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excell sub called from Access: runs twice instead of once!

Status
Not open for further replies.

nath

Programmer
Dec 5, 2001
109
ES
Hi there,

I'm completely at a loss, this is a very strange problem.
I have a button on a form which should open a spreadsheet and call one of its procedures.

It works fine ... except that it runs twice!

Here is my code:

Code:
Private Sub Command25_Click()
    Dim oApp As Object
    Dim wb As Workbook

    Set oApp = CreateObject("Excel.Application")
    Set wb = oApp.Workbooks.Open("MyBook.xls")

    oApp.Run "mySub()"

    wb.Close
    oApp.Quit
    
    Set wb = Nothing
    Set oApp = Nothing

End Sub
[\code]

If, for example, mySub() just pops up a message box, the message will appear twice in a row!!!
Any help would be greatly appreciated,

Nath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top