XL98: ShowDataForm Method Fails If Data Can't Be Found (191115)
The information in this article applies to:
- Microsoft Excel 98 Macintosh Edition
This article was previously published under Q191115 SYMPTOMS
In Microsoft Excel 98 Macintosh Edition, when you use the Visual Basic
ShowDataForm method, you may receive the following error message:
Run-time error '1004':
ShowDataForm method of Worksheet class failed
CAUSE
This error occurs because Microsoft Excel is unable to find a data list on
the worksheet you specified in the Visual Basic statement.
When you use the ShowDataForm method, Microsoft Excel looks for the data
list in two places:
- The defined name "Database." If a range has been defined as the
database, Microsoft Excel will display the data form, and the data in
that range will be accessible.
- Cells A1:B2 on the specified worksheet. Microsoft Excel will attempt
to find a list whose upper-left corner lies in the range A1:B2. If a
list is found, Microsoft Excel will display the data form and the data
in the list will be accessible.
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To work around this problem, define your data with the defined name
database, without quotation marks, or move your data so that its upper-
left corner is located in any of the four cells in the range A1:B2.
To define your data with the defined name "database", do the following:
- Select the range that contains your data.
- On the Insert menu, point to Name, and then click Define.
- In the Name box, type <Sheetname>!Database, where <Sheetname> is the name of the active worksheet.
- Click OK to accept the change.
When you execute the ShowDataForm method and specify the worksheet, the
data form will be displayed with the correct data.
To automate the above process, select the data that you want to be included
in your database (including column headings), and include the following in
your Visual Basic procedure:
ActiveWorkbook.Names.Add Name:=ActiveSheet.Name & _
"!Database", RefersToR1C1:=Selection
ActiveSheet.ShowDataForm
STATUS
This is by design of Microsoft Excel 98 Macintosh Edition.
REFERENCES
For more information about ShowDataForm, from the Visual Basic Editor,
click the Office Assistant, type showdataform, click Search, and then
click to view "ShowDataForm Method."
NOTE: If the Assistant is hidden, click the Office Assistant button on the
Standard toolbar. If the Assistant is not able to answer your query, please
see the following article in the Microsoft Knowledge Base:
176476 OFF: Office Assistant Not Answering Visual Basic Questions
Modification Type: | Major | Last Reviewed: | 6/17/2005 |
---|
Keywords: | kbprb KB191115 |
---|
|