Archive of Mr Excel Message Board


Back to Controls in Excel archive index
Back to archive home

adding Excel commands to button

Posted by Jim Sheldon on June 06, 2001 5:12 AM
I want to create a button that will run the FORM
command that is in the data menu in Excel 97 and attach
it to a specific spreadsheet.

I think 97 works the same as 2000?

Posted by Joe Was on June 06, 2001 5:29 AM

Use the macro recorder. Turn it on, do your FORM selection, turn off the recorder. Open the macro to edit remove the references to cell selection and other unnecessary Excel junk that was added. With macro options assign a hot-key or with View-Forms-toolbar select button draw it where you want it and select the macro you just edited to attach. If you can not get it to work, repost your code and I will fix it. JSW


Re: I think 97 works the same as 2000?

Posted by Jim on June 06, 2001 6:09 AM

I have copied the macro text, but when I try to run the macro
I get a "Run-Time error '1004' ShowDataForm method worksheet
class failed" message.

Sub OpenForm()
'
' OpenForm Macro
' Macro recorded 6/6/01 by Jim Sheldon
'

'
ActiveSheet.ShowDataForm
End Sub


Rus, Try this

Posted by Joe Was on June 06, 2001 8:03 AM


Try this, the use of DataForm requires a data range with a cell selected in that range. If not ShowDataForm fails! I will check and see if their is a work-around for this problem?

Sub OpenForm()
'
' OpenForm Macro
' Macro recorded 6/6/01 by Jim Sheldon
'

'
Worksheets(1).ShowDataForm

End Sub


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.