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 / Importing / Linking / August 2005

Tip: Looking for answers? Try searching our database.

Write To Existing Excel File

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
H_Odish - 26 Aug 2005 15:53 GMT
Trying to write from a table in Access directly to an existing Excel file.
Cant use MSQuery, and dont want to do TransferData, want to write directly.
Can create a blank file and write to that page, but dont know how to write
code in Access to call the existing file as the one to write to.  Any help
would be greatly appreciated.

Thanks-
FSt1 - 29 Aug 2005 13:06 GMT
hi,
Try something like this
Opens a specific excel workbook with VBA   
Public Sub TestMacroRun()   
Dim xlx As Object, xlw As Object, xls As Object, xlc As Object   
Set xlx = CreateObject("Excel.Application")   
xlx.Visible = True   
Set xlw = xlx.workbooks.Open("C:\Filename.xls")   
Set xls = xlw.Worksheets("WorksheetName")   
Set xlc = xls.Range("A1")   
'  put code here to write into the cells etc.   
'  .   
'  .   
'  .   
Set xlc = Nothing   
Set xls = Nothing   
xlw.Save   
xlw.Close False   
Set xlw = Nothing   
xlx.Quit   
Set xlx = Nothing   
End Sub   

regards
FSt1

> Trying to write from a table in Access directly to an existing Excel file.
> Cant use MSQuery, and dont want to do TransferData, want to write directly.
[quoted text clipped - 3 lines]
>
> Thanks-
 
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.