Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default ExecuteExcel4Macro Error

Hi all,

For the first time today I have come across the GetValue function. I
am looking to get values from a (very large) workbook and would prefer
to do it without opening the other wb as it takes up to 3 mins to
open. I also cannot use any method that requires setting a reference
as my workbook is distributed to users running many different versions
of Excel - therefore GetValue seemed a simple and suitable solution.

My code is below;

sub getthevalues
'other code defining pathrr and mypath
p = pathrr
f = mypath
s = "SVRed.xls"
a = "B11"
MsgBox GetValue(p, f, s, a)
end sub


Function GetValue(Path, File, Sheet, Ref)
'Retrieves a value from a closed workbook
Dim Arg As String
'Make sure the file exists
If Right(p, 1) < "\" Then Path = p & "\"
If Dir(Path & f) = "" Then
GetValue = "File not Found"
Exit Function
End If
'Create the argument
Arg = "'" & p & "[" & f & "]" & s & "'!" &
Range(Ref).Range(a).Address(, , xlR1C1)
'Execute XLM macro
MsgBox (Arg)
On Error Resume Next
GetValue = ExecuteExcel4Macro(Arg)
End Function


This errors on;
GetValue = ExecuteExcel4Macro(Arg)

I have checked and re-checked the Arg string and this is definately
correct. I can't seem to find much information about what
ExecuteExcel4Macro is or does and therefore am stumped! I would
appreciate any help or simply explanations.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default ExecuteExcel4Macro Error

On 28 Aug, 21:22, anon wrote:
My code is below;


Function GetValue(Path, File, Sheet, Ref)
* * *'Retrieves a value from a closed workbook
* * Dim Arg As String
* * 'Make sure the file exists
* * If Right(p, 1) < "\" Then Path = p & "\"

.......................... ....... .....
* * MsgBox (Arg)
* * On Error Resume Next
GetValue = ExecuteExcel4Macro(Arg)
End Function

This errors on;
GetValue = ExecuteExcel4Macro(Arg)


Just an idea , maybe you need an If ...Then before
this line of code : GetValue = ExecuteExcel4Macro(Arg)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default ExecuteExcel4Macro Error

You wrote so :
* * *'Execute XLM macro


* * MsgBox (Arg)
* * On Error Resume Next
GetValue = ExecuteExcel4Macro(Arg)
End Function


Ask :
,,ExecuteExcel4Macro(Arg),, is a name of a macro ?

Do you want to Call (Run) a macro from this function ?
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
ExecuteExcel4Macro ... RFraley[_2_] Excel Programming 1 September 22nd 06 05:11 PM
Error on ExecuteExcel4Macro Page.Setup Jim Cone Excel Programming 3 September 13th 05 05:06 PM
Executeexcel4Macro?? (Dave, I need some help) Max Potters Excel Programming 3 August 18th 04 12:59 PM
ExecuteExcel4Macro: Help with this Shilps Excel Programming 0 May 21st 04 10:41 AM
ExecuteExcel4Macro Page.Setup Runtime Error Geoff Martin Excel Programming 1 January 27th 04 01:44 PM


All times are GMT +1. The time now is 06:47 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"