Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Application.Run error

Having read Dave's, sheepishly I must request please ignore mine !

(must have had OnTime in mind)

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
With App.Run you can only call a procedures in a normal module. Also, you
can only pass values as arguments. So, even if you were calling a normal
routine you want not be able to pass the expected range object (your way
would pass its default value property).

In a normal module in Code.xls include a macro like this -

Sub myMacro(sAddr As String)
Dim rng As Range

On Error GoTo errH
Set rng = Range(sAddr) ' recreate the range object
' do stuff here
MsgBox rng(1).Value

Exit Sub
errH:
MsgBox Err.Description

End Sub

In your other workbook call the macro and pass the full address of the
range Target

Application.Run "Code.xls!myMacro", Target.Address(external:=True)

Regards,
Peter T


wrote in message
...
Hi,

I'm using the following code to do a call for a function in a workbook
called "Code"

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Run ("Code.xls!ModuleWorksheet_SelectionChange(Target) ")
End Sub

This code is in my primary project. However I receive an error that
say's the Macro cannot be found.
The "Code.xls" is in a workbook that holds of the codes I wish to use
in my project.(different workbook)
I've used various formats for the above code found on this forum.
Using Excel 2003 windows XP
Any help would be great.

Thanks





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
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 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
Error 1004, Application-definded or object-defined error Mirco Wilhelm[_2_] Excel Programming 9 January 7th 06 04:56 PM
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 11:47 PM.

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

About Us

"It's about Microsoft Excel"