Exporting From Access Advice Please

D

Dermot

I have some excel spreadsheets which are layed out as forms.
There are certain cells within each from where the data varies.

If I create an Access Database to store all my data ...

Is it possible to export data from Access 2003 into the appropriate cells on
my excel form?

Any advice and links would be much appreciated.
Thanks
Dermot
 
J

John Nurick

Hi Dermot,

It's possible; you need to write VBA code to automate Excel. It's best
to use Excel's Named Ranges to name each cell. Then you can do stuff
like this after setting a reference to the Microsoft Excel X.X Object
Library:

Dim oWbk As Excel.Workbook

Set oWbk = GetObject("C:\Folder\File.xls")

With oWbk
'Assign value of textbox txtXXX on current form to named cell XXX
.Names("XXX").RefersToRange.Formula = Me.txtXXX.Value
End With

oWbk.Close True 'save and close
Set oWbk = Nothing
 
Top