ACC97: Errors in "GetObject Function" Example in HelpLast reviewed: August 29, 1997Article ID: Q167590 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. If you copy the example from the "GetObject Function" Help topic in Microsoft Access 97 and paste it into a module, you may receive the following error message when you compile your code:
Compile error: Expected: list separator or )This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.
CAUSEThis error is caused by missing commas in the Declare statement for the SendMessage function. A comma is missing after the ByVal wMsg As Long argument and after the ByVal wParam As Long argument for this function. NOTE: If you insert the missing commas and try to compile your code, you receive another error:
Compile error: Syntax errorThis error is caused by a missing apostrophe (') before the following comment:
Set the object variable to reference the file you want to see. RESOLUTIONModify the following portions of the code in the Help example to include the two missing commas and the missing apostrophe.
Add the Two Missing CommasAdd a comma in the SendMessage Function after the ByVal wMsg As Long argument and after the ByVal wParam As Long argument as follows:
Declare Function SendMessage Lib "user32" Alias _ "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long Add an Apostrophe for the CommentAdd an apostrophe (') to remark the "Set the object variable to reference the file you want to see" comment as follows:
' Set the object variable to reference the file you want to see. Set MyXL = GetObject("c:\vb4\MYTEST.XLS") Keywords : AutoGnrl DcmHlp kberrmsg kbole PgmApi SynGnrl IntpOleA Version : 97 Platform : WINDOWS Hardware : x86 Issue type : kbprb Solution Type : Info_Provided |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |