View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_2_] Leith Ross[_2_] is offline
external usenet poster
 
Posts: 128
Default Run-time Error '1004'

On Oct 13, 10:11 pm, BigBrother
wrote:
Hi,

I have a simple function (below) that generates the following message
"Run-time Error '1004': Application-defined or object-defined error". Any
ideas on what I am doing wrong?

Thanks tons!

Public Sub Workbook_Open()

Application.VBE.ActiveVBProject.VBComponents.Item( "Module1").CodeModule.ReplaceLine 1, "TEST LINE"

End Sub


Hello BigBrother,

Have you set a reference in your VBA project to the Microsoft
Extensibility for Visual Basic? I tried several ways to reproduce your
error, but was unable. I tried no reference to the VBIDE in the
project, no module, and no prior code in the module. Error 1004 never
came up. Sorry I couldn't be more help.

Sincerely,
Leith Ross