[AccessD] A2010 - Export Query Results to Excel - Plus some other bits

Ryan W wrwehler at gmail.com
Mon Aug 14 20:44:14 CDT 2023


Using DoCmd.TransferSpreadsheet and using the range argument will name a
new tab in an existing workbook with the range "name".

Unsure if it would overwrite or duplicate/append to an existing tab.

If you want to get smarter about it I'm sure using COM to manipulate or
create excel workbooks with sheets would be the way to go.





On Mon, Aug 14, 2023 at 7:10 PM Darren - Active Billing <
darren at activebilling.com.au> wrote:

> Hi All,
>
> Long time no post - Don't do much Access stuff these days, but I have a
> Not-For-Profit pro-bono job (Rewriting something from 15 years ago)
>
>
> The Situiation:
>
> I have some queries that need to be output to excel. I managed to get that
> bit to work.
>
> And the process I have adds the Column header names - So that’s cool - And
> the Naming of the file and the naming of the Worksheet tab all works ok.
>
> So that all works OK for one query, outputting to one Excel File, with one
> Worksheet (one tab)
>
>
> The Question:
>
> But…there is a need to add tab, after tab, after tab, named by date
> (dd_MMM_yyyy) of essentially the same data/queries.
>
> (Users want to see their incremental changes organised by date named tabs)
>
> So…what I really need is to be able to output the results of a query to a
> known/existing Excel file, but in a new worksheet (new tab) and to be able
> to name this new tab as I do so.
>
>
> Nice to have:
>
> And if possible is it possible to see if a TAB name of the dd_MMM_yyyy
> exists and then just append the new tab with something like dd_MMM_yyyy_x
>
> (though that request above is not essential as I can just add a time
> component to the name to solve that issue)
>
> Make sense?
>
> Many thanks in advance, team
>
> Darren
>
>
> --
> 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