重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

【GOLF me!】初月無料お試し

http://www.microsoft.com/japan/msdn/columns/offi …

にて示されたWebクエリダイアログを作成中:

以下の 'エラー の行で
「compile error:メソッドまたはデータメンバが見つかりません」
が発生、頓挫中。
ご教授お願いします。


Dim gcolTablesOnPage(15) As String
Dim gintCurrentRecord As Integer
Private Declare Sub Sleep Lib "KERNEL32" (ByVal dwMilliseconds As Long)

Private Sub CB1_Click()

WebBrowser1.Navigate2 "http://quote.yahoo.co.jp/m3?u"
Call Sleep(5999)

MsgBox "*"


Set colTables = WebBrowser1.Document.all.tags("TABLE")


End Sub

Private Sub CB3_Click()
Dim colTables As Object
Dim colCurrentTable As Object
Dim intcntr As Integer

With WebBrowser1
gintCurrentRecord = 0
Set colTables = .Document.all.tags("TABLE")
For Each colCurrentTable In colTables
Call cHTM(colCurrentTable.outerhtml, gintCurrentRecord)
gintCurrentRecord = gintCurrentRecord + 1
Next colCurrentTable
End With

End Sub

Function cHTM(x, gintCurrentRecord)
Dim tempHtml As String
tempHtml = gcolTablesOnPage(gintCurrentRecord)
tempHtml = "<HTML><HEAD><TITLE></TITLE></HEAD><BODY>" & x & "</BODY></HTML>"
End Function

Private Sub CB5_Click()
Dim gintCurrentRecord As Integer

gintCurrentRecord = 0
If Me.gintCurrentRecord < gcolTablesOnPage.Count Then 'エラー
Me.gintCurrentRecord = Me.gintCurrentRecord + 1
WebBrowser1.Navigate2 gcolTablesOnPage(Me.gintCurrentRecord)
End If
ge.Count

End Function

A 回答 (2件)

>Dim gintCurrentRecord As Integer



と宣言されているので、gintCurrentRecordの値を調べる際に、Me.gintCurrentRecordとしてしまうとエラーになります。


なので、
Public gintCurrentRecord As Integer

とするか、

If gintCurrentRecord <

とする必要があります。
    • good
    • 0

>Dim gcolTablesOnPage(15) As String



String型の配列に、

>If Me.gintCurrentRecord < gcolTablesOnPage.Count Then 'エラー

Countというプロパティやメソッドはありません。

配列の要素数が欲しいのでしたら、
UBound(gcolTablesOnPage) - LBound(gcolTablesOnPage) + 1
です。
    • good
    • 0
この回答へのお礼

ご回答の方、ありがとうございます。

補足いたしますと、
.gintCurrentRecord の部分がハッチングされ(網掛け)、ここが原因でコンパイルエラーとなっております。taka_tetsu様のアドバイスを実行したところ、.gintCurrentRecord でコンパイルエラーがあり、この部分の対応が必要となっております。

ぜひもう一度アドバイスをいただきたくお願いします。

また、Dim gcolTablesOnPage(15) As Stringは自分で付け加えたものです。Private Sub CommandButton5_Click()内のコードはウェブで紹介されているものです。

お礼日時:2004/09/09 09:26

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!