Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run-time Error '1004'

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Run-time Error '1004'

The first thing I would look at is whether the "Trust access to the VB
project" setting is checked. Go to the Tools menu, Macros, Security, Trusted
Publisher, and check "Trust Access To Visual Basic Project".


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"BigBrother" wrote in message
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run-time Error '1004'

Chip.

This worked! Thanks a lot!!!

"Chip Pearson" wrote:

The first thing I would look at is whether the "Trust access to the VB
project" setting is checked. Go to the Tools menu, Macros, Security, Trusted
Publisher, and check "Trust Access To Visual Basic Project".


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"BigBrother" wrote in message
...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run time error 1004 general odbc error excel 2003 vba Mentos Excel Programming 5 January 24th 11 02:56 PM
Run Time Error 1004: Application or Object Defined Error BEEJAY Excel Programming 4 October 18th 06 04:19 PM
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM


All times are GMT +1. The time now is 09:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"