PDA

Click to See Complete Forum and Search --> : Excel Run a Macro


R@emdonck
Jan 25th, 2000, 02:05 PM
Hi,

How can I run a Macro in an Excel workbook?
I have this code, but I always get error 1004.
Who can help me?

R@emdonck


Sub DataToExcel()
Set xlsheet = GetObject("C:\WINNT40\Profiles\borbcf01\Desktop\Excel_Test.xls")
xlsheet.Application.Visible = True
xlsheet.Parent.Windows(1).Visible = True
xlsheet.Activate
xlsheet.Application.Run ("MyMacro")
xlsheet.Application.Quit
Set xlsheet = Nothing
End Sub

'run-time error '1004':
'The macro 'MyMacro' cannot be found.