Access Table to Excel not overwriting existing sheet in Excel.

R

robertadamharper

I have below some code that opens excel and imports a sheet from it.

I now need a bit of code inserted into the below code that transfers a
table from access ("Material_Demand_18Mths") to excel, overwriting the
existing sheet in there. Then my code below will take it back out
again.

Existing code:-

Option Compare Database

Function AutomateExcelProvision_Other()
Dim xl As Object
Dim SourceFile As String
Set xl = CreateObject("Excel.Application")

SourceFile = "C:\Documents and Settings\harperro\Desktop
\SAP_Planner_SAVED\x RECAL_MODEL_DEMAND_Linked.xls" '

xl.Workbooks.Open SourceFile
xl.Visible = False
xl.Wait (2000)
xl.Save
xl.DisplayAlerts = False
xl.Application.Quit

Set xl = Nothing

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top