Share via

Export query to excel

Anonymous
2023-04-28T14:36:00+00:00

I have a routine in my database, that when I exit the database, it runs a query and copies the query data to excel. I would like for the
column labels to be protected in the excel spreadsheet. I know I can just open the spreadsheet and protect row #1, but I am not always

available to do that. Is there away I can have MS Access export / save my query and protect row #1 or the heading labels?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. George Hepworth 22,855 Reputation points Volunteer Moderator
    2023-04-29T14:29:58+00:00

    My apologies, sometimes my replies go on and on and get boring, but sometimes I have the opposite problem.

    What I meant was that you could record the macro which protects row 1 in the sheet in Excel, then copy that VBA to use in the Access routine that exports the new sheet. VBA is common to both applications, all Office applications, in fact. So, with some minor adjustments in Access, you would have the code from Excel to build on.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-04-28T23:08:53+00:00

    I have recorded macros. But, i rewrite the excel spreadsheet with every update. I need access to do this, not excel. This is what im looking for.

    Was this answer helpful?

    0 comments No comments
  3. George Hepworth 22,855 Reputation points Volunteer Moderator
    2023-04-28T22:17:57+00:00

    Have you ever recorded macros in Excel? That's often the quickest way to get started.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-04-28T17:42:37+00:00

    Thank you, but I do not know how to automate that function in excel.

    Was this answer helpful?

    0 comments No comments
  5. George Hepworth 22,855 Reputation points Volunteer Moderator
    2023-04-28T14:48:34+00:00

    If you can automate that function in Excel VBA, then you can use that same VBA in Access via automation.

    Was this answer helpful?

    0 comments No comments