Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 7264

ExcelVBA Delegate文がエラーになる

$
0
0
Excel2010 VBAでの質問です。 画面上のすべてのトップレベルウィンドウを取り出そうと、標準モジュールに以下コーディングしました。 Option Explicit Declare Function EnumWindows Lib "User32.dll" (ByVal Proc As EnumWinProc, ByVal lParam As Integer) As Boolean Delegate EnumWinProc (ByVal hwnd As IntPtr, ByVal lParam As Integer) As Boolean Sub Main() Call EnumWindows(AddressOf disp_hwnd, 0) MsgBox ("完了") End Sub Function disp_hwnd(ByVal hwnd As IntPtr, ByVal lParam As Integer) As Boolean MsgBox (hwnd) disp_hwnd = True End Function そうしたところ、Delegate 文が赤文字に反転してエラーになります。 Excel2003 VBAでは使えない構文なのでしょうか?あるいは何かのミスなのでしょうか? 環境ですが、WindowsXP SP3、Excel2003 SP3です。 .NET Framework1.1、2.0、3.0、4.0がインストールされています。 あと、以下の参照設定はあります。   Visual Basic For Applications Microsoft Excel 11.0 Object Library OLE Automation Microsoft Office 11.0 Object Library Microsoft Forms 2.0 Object Library Microsoft Scripting Runtime Microsoft Windows Common Controls 6.0 (SP6) 以上、よろしくお願いします。

Viewing all articles
Browse latest Browse all 7264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>