Thread: Command Button
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
steveb[_3_] steveb[_3_] is offline
external usenet poster
 
Posts: 3
Default Command Button

Michelle,

Tried this in a dummy workbook and changed the line:
DoCmd.RunMacro stDocName
to
Run stDocName

and it worked like a champ.
(am using Excel 2002)

hth
steveb

"Michelle" wrote in message
...
Hi There,

I could not get a commandbutton (that I titled submit survey) to send the

survey to me, so what I did was record a macro and tried to execute the
macro from the button, it mostly works (see code below) but I keep getting
object required, but do not understand what it is looking for ... Is anybody
out.... Can Anybody help me :{ ... Confused and frustrated...

Private Sub CommandButton1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String

stDocName = "SubmitSurvey"
DoCmd.RunMacro stDocName

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub