Reputation: 317
Hi I am trying to run a very simple Microsoft Excel Macro, the code shown below:
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Test value"
However I continue to receive the following error:
Run-time Error '-2147024769 (8007007f)':
Automation Error
The specified procedure could not be found
Does anybody know what could be causing this? After some digging, its something to do with the COM. Thank you very much in advance!
Upvotes: 0
Views: 314
Reputation: 4704
You are already in Excel so all you need is
sub demo
Workbooks.Add()
Range("A1")="Test Value"
End Sub
Your code would work in Word however - where it would open Excel, then a workbook and then write to A1.
Upvotes: 1