Controlling Excel From Access

  • Thread starter Thread starter Keith Wilby
  • Start date Start date
K

Keith Wilby

I have an Access app that creates a new worksheet in the workbook chosen by
the user via a dialog box. I would like the new worksheet to appear at the
end of the existing collection of worksheets. Would anyone happen to know
the syntax for getting a count of sheets in the current workbook and using
that count to place the new sheet at the end?

Many thanks.

Keith.
 
xlApp is a reference to the currently opened Excel workbook and xlWS is the
reference to the new sheet you have added

xlWS.Move After:=xlApp.Worksheets(xlApp.Worksheets.Count)
 
Dennis said:
xlApp is a reference to the currently opened Excel workbook and xlWS is
the
reference to the new sheet you have added

xlWS.Move After:=xlApp.Worksheets(xlApp.Worksheets.Count)

Dennis, thank you, just the job.

Regards,
Keith.
 

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

Back
Top