about macro....

hi all. if any1 can help me...

i hav simple form having 1 command button...on click event of it i hac call 1 function....

the code is as shown below....

*****code*******

Function Macro2()
On Error GoTo Macro2_Err

' all data

DoCmd.TransferSpreadsheet acImport, 8, "tableimport", "D:\hetal\vb\tempxl.xls", True, ""


Macro2_Exit:
Exit Function

Macro2_Err:
MsgBox Error$
Resume Macro2_Exit

End Function

Private Sub cmd1_Click()
Call Macro2
End Sub

*******

after running and clickin on button.. i m getting error like...." Object required"....

so... how to add macro object on form... error is for line... DoCmd.tran... line of above code... plz help me...



Answer this question

about macro....

  • myoungbl

    Hi whocracks,

    i checked your code onMS Office Access 2003,and it works fine!

    but for further assistance, it is prefered to ask ur question on http://msdn.microsoft.com/newsgroups/topic.aspx url=/MSDN-FILES/028/201/008/topic.xml

    mario



  • arkiboys

    This post is off-topic for this forum. I'm moving this thread to the VBA forum in order for you to get a bette44r response to your question.

    MSDN Forums Moderator



  • JohnGray

    thanx...

    it works fine in Access... buti want this code inVB 6,0... so how can i do that....

    when i run this code in VB.. it shows d error "object required"....


  • AbeR

    thanx...

    i knw that it works fine in Msaccess....

    actually i want to run that code in VB 6.0.... so how can i do that....


  • about macro....