[AccessD] Access plus Excel question
Bill Benson
bensonforums at gmail.com
Sat Sep 11 09:16:45 CDT 2021
Best way in my opinion is to instantiate excel and use its Range.
CopyFromRecordset method to put data into row 2 and then loop to place the
fields afterwards in Row 1.
CopyFromRecordset I believe is quite good at handling all data types and
the recordset fields are easy to loop.
If I use a template (for no better reason than portability and to control
the output a bit better, I store a maceo enabled workbook in an attachment
field and use some method I can’t recall off the top of my head to export
the file. I set the instantiated Excel object’s
Application.AutomationSecurity property to 1 if I intend to call its macros
through Application.Run.
On Thu, Sep 9, 2021 at 1:30 PM Arthur Fuller <fuller.artful at gmail.com>
wrote:
> The Access app I'm working on invokes Excel and tis part works perfectly.
> Access builds up the XLS filename, complete with path, company, project and
> actual XLS filename -- smooth as silk.
>
> One problem remains. What Excel receives is the tabular data and nothing
> else. I want to include some header information above the grid in the XLS
> file, similar to what I do in the Access report to which the XLS file
> corresponds.
> A couple of things come to mind. Use an XL template with a few named
> ranges, then address those from Access once the XLS file is open, or
> reverse the process and have Excel call back to Access and have it return
> the data. (Access can make the three items of interest available using
> three static functions.) Another notion that occurred to me depends
> on whether I can pass parameters to Excel when I invoke it.
> Besides these, there are doubtless other approaches I might use to get
> there. Any suggestions?
>
> (If it matters, this is all being done in Office 365.)
>
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list