C
Colleyville Alan
I had written an app that queried company names and related info from
Access, opened PowerPoint, created a blank presentation, then copied
individual slides from other PPT files based on a lookup table. At the end
of this app, I used the SaveAs command to rename the new presentation to the
name of the company whose info I was working with.
Now I am trying to do something similar in Excel. I have had memory
corruption problems and "ghost" Excel references. These, I have discovered,
are often caused by references that are not fully qualified and from using
"With" constructs that also may leave a reference not fully qualifited. I
eliminated those and still had memory problems.
So I commented out nearly all of the code and simply had Access perform a
query, load the results into an array, open Excel but not write anything to
Excel. This all worked without a hitch. Then I uncommented out the SaveAs
command and have run into problems. I have established oXLWKS as an object
variable set to the ActiveSheet. I invoke the command " oXLWKS.SaveAs
DestinationPath + strPlanName & ".XLS" which I think should work. I have
also tried this with an object variable set to the ActiveWorkbook rather
than the ActiveSheet. I still get an error that the "SaveAs" method failed.
I only get this error if either there exists a file with the same name (I
chose SaveAs to overwrite it), or if the memory has already been corrupted
(manually closing Excel will not work, I need to use Task Mgr). Is there a
trick to use to overwrite an existing file that I have overlooked? Does the
problem lie elsewhere?
Thanks
Access, opened PowerPoint, created a blank presentation, then copied
individual slides from other PPT files based on a lookup table. At the end
of this app, I used the SaveAs command to rename the new presentation to the
name of the company whose info I was working with.
Now I am trying to do something similar in Excel. I have had memory
corruption problems and "ghost" Excel references. These, I have discovered,
are often caused by references that are not fully qualified and from using
"With" constructs that also may leave a reference not fully qualifited. I
eliminated those and still had memory problems.
So I commented out nearly all of the code and simply had Access perform a
query, load the results into an array, open Excel but not write anything to
Excel. This all worked without a hitch. Then I uncommented out the SaveAs
command and have run into problems. I have established oXLWKS as an object
variable set to the ActiveSheet. I invoke the command " oXLWKS.SaveAs
DestinationPath + strPlanName & ".XLS" which I think should work. I have
also tried this with an object variable set to the ActiveWorkbook rather
than the ActiveSheet. I still get an error that the "SaveAs" method failed.
I only get this error if either there exists a file with the same name (I
chose SaveAs to overwrite it), or if the memory has already been corrupted
(manually closing Excel will not work, I need to use Task Mgr). Is there a
trick to use to overwrite an existing file that I have overlooked? Does the
problem lie elsewhere?
Thanks