SEARCH

Tuesday, March 3, 2015

Open workbooks Excel from MS Access VBA, Solution for Runtime error 1004

How to open Excel workbooks file using VBA from MS access

Function bukaExcel()

    Dim xlKu As Object
     
    FullPath = CurrentProject.Path & "\BIF_INVOICE.xlsm"
     Set xlKu = CreateObject("Excel.Application")

   
  
    With xlKu
        .Application.Visible = True
        .Workbooks.Open (FullPath)
    End With

End Function


Notes :

If you found error 1004 , Methode Open workbooks failed , it is because your excel file contain Macro / VBA script or perhaps ODBC data connection , what you need to do is from MS. excel file go to  Options --> Trust Center and give permission to run macro script


by :

http://freelance-it-trainer.blogspot.com
Hery Purnama 081.223344.506 , IT trainer , Excel / access VBA Macro, MS Project, Primavera,
PHP Ajax Jquery, Google Map API, Google Sketchup3D, Ubuntu, Sencha ExtJS, YII, Code Igniter,
Oracle, SQL Server,

0 comments:

Post a Comment

Silahkan isikan comment box untuk komentar Anda..