Error message when you expand a scrolling window by using VBA in Microsoft Dynamics GP: "Run-time error '1008': Unsafe Operation"


Symptoms


When you use Visual Basic for Applications (VBA) in Microsoft Dynamics GP and in Microsoft Business Solutions – Great Plains 8.0 to automatically expand a scrolling window (also known as a grid in VBA), you receive the following error message:

Run-time error '1008': Unsafe Operation. An attempt was made to set a value into an application field which is disabled. This operation could compromise the integrity of the application.

Cause


This error occurs if the visible icon for expanding the scrolling window is a non-editable visual switch field that only contains an image. VBA does not allow for the value of a non-editable field to be changed.

Resolution


To resolve this problem, use a hidden push button field that is overlaid with the same size and position as the visual switch icon field.



For more information about how to add a hidden field, click the following article number to view the article in the Microsoft Knowledge Base:

951230 How to add a hidden field with Visual Basic for Applications in Microsoft Dynamic GP