CopyFromRecordset Doesn't Fail in User-Defined Worksheet (152207)



The information in this article applies to:

  • Microsoft Excel for Windows 95

This article was previously published under Q152207

SYMPTOMS

The CopyFromRecordset method should fail if you call it in a user-defined worksheet function, but the CopyFromRecordset allows a user-defined worksheet function to place information in a worksheet. This can cause Microsoft Excel to go into an infinite recalculation loop.

RESOLUTION

The CopyFromRecordset method is not supported for use in a user-defined worksheet function, and should not be used.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

A user-defined worksheet function is a Function procedure designed to be called from a formula in a worksheet.

Generally, a user-defined worksheet function makes a calculation and returns a value. You can enter the Function procedure name in a worksheet cell and return a value to the cell the same way that you use a built-in Microsoft Excel worksheet function.

User-defined worksheet functions can replace one long formula or several formulas. You can combine mathematical expressions, built-in Microsoft Excel worksheet functions, and Visual Basic code. User-defined worksheet functions can also work with text, dates, and values.

A user-defined worksheet function cannot set properties or execute methods that change the Microsoft Excel environment in ways such as the following:

  • inserting, deleting, or formatting cells
  • changing cell values
  • moving, renaming, deleting, or adding sheets
  • changing the calculation mode or screen views
For more information about the CopyFromRecordset method, click Answer Wizard on the Help menu and type:

CopyFromRecordset


Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbProgramming KB152207