Jumat, 30 Desember 2011

[smf_addin] Digest Number 2061

Messages In This Digest (7 Messages)

Messages

1a.

How to call UDF RCHGetYahooHistory in an Excel Macro

Posted by: "Tianhao Li" tianhao.li@yahoo.com   tianhao.li

Thu Dec 29, 2011 3:26 pm (PST)



Hi Randy,

I'm a new member to this group. I just started using the smf addin literally from yesterday. I came across a question for you.

I'm coding up a macro in Excel where I want to call up this RCHGetYahooHistory function. I don't want/need to explicitly populate all historical data into a spreadsheet range. I'd rather want to save the returned data into a data array. So in my macro, I'm using:

sData = Application.Run("RCHGetYahooHistory", Symbol, 2011, 12, 1, , , , , , , 1, 1)

But I'm getting a compiling error: Cannot assign to array.

Can you please help me out here?
Thanks a lot,
BTW, smf_addin is a great tool!

Tianhao
1b.

Re: How to call UDF RCHGetYahooHistory in an Excel Macro

Posted by: "Tianhao Li" tianhao.li@yahoo.com   tianhao.li

Thu Dec 29, 2011 3:27 pm (PST)



Oh forgot to mention that sData is defined as an array:

Dim sData(1 To 1000, 1 To 6) As Variant

Thanks

________________________________
From: Tianhao Li <tianhao.li@yahoo.com>
To: "smf_addin@yahoogroups.com" <smf_addin@yahoogroups.com>
Sent: Thursday, December 29, 2011 2:18 PM
Subject: How to call UDF RCHGetYahooHistory in an Excel Macro


Hi Randy,

I'm a new member to this group. I just started using the smf addin literally from yesterday. I came across a question for you.

I'm coding up a macro in Excel where I want to call up this RCHGetYahooHistory function. I don't want/need to explicitly populate all historical data into a spreadsheet range. I'd rather want to save the returned data into a data array. So in my macro, I'm using:

sData = Application.Run("RCHGetYahooHistory", Symbol, 2011, 12, 1, , , , , , , 1, 1)

But I'm getting a compiling error: Cannot assign to array.

Can you please help me out here?
Thanks a lot,
BTW, smf_addin is a great tool!

Tianhao
1c.

Re: How to call UDF RCHGetYahooHistory in an Excel Macro

Posted by: "Randy Harmelink" rharmelink@gmail.com   rharmelink

Thu Dec 29, 2011 3:29 pm (PST)



Check out the "Links" area of the group -- there is an item there about
using the add-in functions in VBA.

I would never use the Application.Run() to run an add-in function.

On Thu, Dec 29, 2011 at 3:18 PM, Tianhao Li <tianhao.li@yahoo.com> wrote:

>
> I'm a new member to this group. I just started using the smf addin
> literally from yesterday. I came across a question for you.
>
> I'm coding up a macro in Excel where I want to call up this
> RCHGetYahooHistory function. I don't want/need to explicitly populate all
> historical data into a spreadsheet range. I'd rather want to save the
> returned data into a data array. So in my macro, I'm using:
>
> sData = Application.Run("RCHGetYahooHistory", Symbol, 2011, 12, 1, , , , ,
> , , 1, 1)
>
> But I'm getting a compiling error: Cannot assign to array.
>
> Can you please help me out here?
> Thanks a lot,
> BTW, smf_addin is a great tool!
> Tianhao
>
1d.

Re: How to call UDF RCHGetYahooHistory in an Excel Macro

Posted by: "Tianhao Li" tianhao.li@yahoo.com   tianhao.li

Thu Dec 29, 2011 4:22 pm (PST)



Thanks for the prompt response, Randy.

I figured out how to call up a smf function after reading through the links.

However, is there anyway that I can assign the output of smf function to a data array as I defined in below?

Dim sData(1 To 1000, 1 To 6) As Variant

This is critical to me.
Thanks,

________________________________
From: Randy Harmelink <rharmelink@gmail.com>
To: smf_addin@yahoogroups.com
Sent: Thursday, December 29, 2011 3:29 PM
Subject: Re: [smf_addin] How to call UDF RCHGetYahooHistory in an Excel Macro


 
Check out the "Links" area of the group -- there is an item there about using the add-in functions in VBA.

I would never use the Application.Run() to run an add-in function.

On Thu, Dec 29, 2011 at 3:18 PM, Tianhao Li <tianhao.li@yahoo.com> wrote:

>
>I'm a new member to this group. I just started using the smf addin literally from yesterday. I came across a question for you.
>
>
>I'm coding up a macro in Excel where I want to call up this RCHGetYahooHistory function. I don't want/need to explicitly populate all historical data into a spreadsheet range. I'd rather want to save the returned data into a data array. So in my macro, I'm using:
>
>
>sData = Application.Run("RCHGetYahooHistory", Symbol, 2011, 12, 1, , , , , , , 1, 1)
>
>
>But I'm getting a compiling error: Cannot assign to array.
>
>
>Can you please help me out here?
>Thanks a lot,
>BTW, smf_addin is a great tool!
>
>Tianhao
>

1e.

Re: How to call UDF RCHGetYahooHistory in an Excel Macro

Posted by: "Randy Harmelink" rharmelink@gmail.com   rharmelink

Thu Dec 29, 2011 5:10 pm (PST)



Easiest to just do something like:

Option Explicit
Sub Test()
Dim vData() As Variant
vData = RCHGetYahooHistory("MMM", , , , , , , , , , , , 1000, 6)
End Sub

On Thu, Dec 29, 2011 at 5:22 PM, Tianhao Li <tianhao.li@yahoo.com> wrote:

>
> However, is there anyway that I can assign the output of smf function to a
> data array as I defined in below?
>
> Dim sData(1 To 1000, 1 To 6) As Variant
>
>
2a.

beginner's RCHGetURLData error help

Posted by: "upsquare78" dwvancouver@yahoo.com   dwvancouver

Thu Dec 29, 2011 11:30 pm (PST)



I'm getting the compile error "sub or function not defined" with RCHGetURLData highlighted in modGetYahooQuotes. I'm trying to run the following modules modGetElementNumber, modGetYahooHistory, modGetYahooQuotes, WSJCashFlows, and Yahoo; the latter two I believe are from the time-period of the older 2.0f version. modGetElementNumber, modGetYahooHistory, modGetYahooQuotes are of the current version. The spread sheet originally only required 5 modules. Am I supposed to add the modUtilities module? Not sure what to do. [On excel 2007,vista]

And a general question, will an excel spreadsheet only auto-update when a corresponding webpage is open? or does the ticker not require the website to be open in the background...

2b.

Re: beginner's RCHGetURLData error help

Posted by: "Randy Harmelink" rharmelink@gmail.com   rharmelink

Thu Dec 29, 2011 11:38 pm (PST)



If you're a beginner, why aren't you just installing the add-in and using
the functions from there? But, yes, you would definitely need the
modUtilities module. But if you're mixing and matching modules from
different versions of the add-in, you could be asking for a lot of
problems. One of the reasons for using the add-in as a separate entity is
so you don't need to update all of the code.

WSJCashFlows and Yahoo are not add-in modules.

The add-in retrieves its own copy of the web page, so you wouldn't need to
have it open in a browser. Visit the "Links" area of the group and read
some of the smfForceRecalculation macro items to get an overview of the way
the add-in is grabbing the data.

On Thu, Dec 29, 2011 at 10:46 PM, upsquare78 <dwvancouver@yahoo.com> wrote:

> I'm getting the compile error "sub or function not defined" with
> RCHGetURLData highlighted in modGetYahooQuotes. I'm trying to run the
> following modules modGetElementNumber, modGetYahooHistory,
> modGetYahooQuotes, WSJCashFlows, and Yahoo; the latter two I believe are
> from the time-period of the older 2.0f version. modGetElementNumber,
> modGetYahooHistory, modGetYahooQuotes are of the current version. The
> spread sheet originally only required 5 modules. Am I supposed to add the
> modUtilities module? Not sure what to do. [On excel 2007,vista]
>
> And a general question, will an excel spreadsheet only auto-update when a
> corresponding webpage is open? or does the ticker not require the website
> to be open in the background...
>
Recent Activity
Visit Your Group
Yahoo! News

Fashion News

What's the word on

fashion and style?

Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Ads on Yahoo!

Learn more now.

Reach customers

searching for you.

Need to Reply?

Click one of the "Reply" links to respond to a specific message in the Daily Digest.

Create New Topic | Visit Your Group on the Web
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

Tidak ada komentar:

Posting Komentar