Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2006

Tip: Looking for answers? Try searching our database.

How do I open an Excel Spreadsheet from Access using VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robbie - 05 Feb 2006 13:51 GMT
Running Access 2003 and need to open an Excel spreadsheet to run an excel
macro by clicking a button on an Access Form.  Does anyone have some code
samples that show this?
Signature

Robbie

Dave Patrick - 05 Feb 2006 14:16 GMT
This may give you some ideas.

Function Open_TrainLoadingEast()
   Dim xlApp As Variant
   Dim xlBook As Variant
   Set xlApp = CreateObject("Excel.Applicatio­n")
   Set xlBook = xlApp.Workbooks.Open("C:\data\­excel\TrainLoading.xlt")
   xlApp.sheets("Data").range("e1­") = Forms!frmLoading.txtDate
   xlApp.sheets("Data").range("e2­") = Forms!frmLoading.opt1.Value
   xlApp.Run "EastPrint"
   'xlApp.Application.Visible = True
   xlBook.Close (False)
   xlApp.Quit
   Set xlApp = Nothing
   Set xlBook = Nothing
End Function

Signature

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

| Running Access 2003 and need to open an Excel spreadsheet to run an excel
| macro by clicking a button on an Access Form.  Does anyone have some code
| samples that show this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.