View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Automation problem

It would help to know the specific error. Also, is this a workbook you
opened from a saved copy, or is it a new workbook generated by your code?
Instead of ActiveWorkbook you should be able to refer to the workbook by
name, Workboooks(BookName), as long as you know (or set) the name. If opened
from a file, it should be the file name, e.g. Workbooks("saved file.xls"); if
created in code it is normally Workbooks("Book1") for the first one created,
etc.
--
- K Dales


"Tim Long" wrote:

Hello, I am exporting Access 97 data to Excel (using TransferSpreadsheet
etc). Through an Access procedure I am then formatting the data in the
exported file. The problem is that when I run the code, I come up against an
error message on the following line of code:

xlApp.ActiveWorkbook.SaveAs ("filepath")

Elsewhere in the procedure I have avoided using any reference to ActiveCells
etc and the code runs ok, but I don't know an alternative to
ActiveWorkbook.SaveAs. Could anyone please advise? Many thanks in advance...

Tim Long

I have checked that the Excel 8.0 reference is present, have checked that
the file doesn't already exist and have tried clearing every Excel process
using task manager before running the code. All to no avail.