ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2002 and the .emf files (https://www.excelbanter.com/excel-programming/313985-excel-2002-emf-files.html)

Joshua Campbell

Excel 2002 and the .emf files
 
I have a program that starts an instance of Excel 2002, creates a
spreadsheet, prints it, and closes. It does this roughly 400 times a day.
As you can imagine, this means that a lot of .emf files are going to be
created by Excel, and this can fill up a hard drive if left unchecked. Is
there a way to keep Excel from creating these files?

Thanks.
Joshua



keepITcool

Excel 2002 and the .emf files
 

I assume you mean the EMF files generated by excel
in the temp folder?

These files are generated only/mostly?
for embedded controls on worksheets.

So your code may create sheets with embedded controls?


Either:
get rid of the embedded controls and replace
with native controls from the form toolbar.


close excel properly when your routine finishes.
when excel is closed (not Terminiated via API)
it should (and normally does) clear up any
mess left in the temp dir.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

I have a program that starts an instance of Excel 2002, creates a
spreadsheet, prints it, and closes. It does this roughly 400 times a
day. As you can imagine, this means that a lot of .emf files are going
to be created by Excel, and this can fill up a hard drive if left
unchecked. Is there a way to keep Excel from creating these files?

Thanks.
Joshua





Joshua Campbell

Excel 2002 and the .emf files
 
Yes, in the TEMP folder. Sorry for not being specific.

To the best of my knowledge, I am not creating any embedded controls.

In my VB.NET app, I have the following commands:
xlbook.Close(False)
xlapp.Quit()
'Release the references we have

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlsheet)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlbook)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlapp)

Did I not close something properly?




"keepITcool" wrote in message
...

I assume you mean the EMF files generated by excel
in the temp folder?

These files are generated only/mostly?
for embedded controls on worksheets.

So your code may create sheets with embedded controls?


Either:
get rid of the embedded controls and replace
with native controls from the form toolbar.


close excel properly when your routine finishes.
when excel is closed (not Terminiated via API)
it should (and normally does) clear up any
mess left in the temp dir.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

I have a program that starts an instance of Excel 2002, creates a
spreadsheet, prints it, and closes. It does this roughly 400 times a
day. As you can imagine, this means that a lot of .emf files are going
to be created by Excel, and this can fill up a hard drive if left
unchecked. Is there a way to keep Excel from creating these files?

Thanks.
Joshua







keepITcool

Excel 2002 and the .emf files
 
I'm an old VBA hack and I haven't yet found it necessary to
migrate to .Net interops etc. <g

although your code makes sense to me..



I'd test following:

clean the temp.
run your code.
check the temp.. and open the emf files to see what they are..
(and check that they are in fact generated by your code...


that's it for me..





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

Yes, in the TEMP folder. Sorry for not being specific.

To the best of my knowledge, I am not creating any embedded controls.

In my VB.NET app, I have the following commands:
xlbook.Close(False)
xlapp.Quit()
'Release the references we have

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlsheet)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlbook)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlapp)

Did I not close something properly?




"keepITcool" wrote in message
...

I assume you mean the EMF files generated by excel
in the temp folder?

These files are generated only/mostly?
for embedded controls on worksheets.

So your code may create sheets with embedded controls?


Either:
get rid of the embedded controls and replace
with native controls from the form toolbar.


close excel properly when your routine finishes.
when excel is closed (not Terminiated via API)
it should (and normally does) clear up any
mess left in the temp dir.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

I have a program that starts an instance of Excel 2002, creates a
spreadsheet, prints it, and closes. It does this roughly 400 times

a
day. As you can imagine, this means that a lot of .emf files are

going
to be created by Excel, and this can fill up a hard drive if left
unchecked. Is there a way to keep Excel from creating these files?

Thanks.
Joshua









Joshua Campbell

Excel 2002 and the .emf files
 
Apparently, the problem does lie in bad code. My code basically puts data
from an array into various cells, gives the worksheet a background, prints
the sheet, and closes. The mso*.emf file that is left is a copy of the
background image. Weird. Oh well. I'll probably just create a scheduled
task then to delete these files on a regular basis.

Thanks for your help!
Joshua


"keepITcool" wrote in message
...
I'm an old VBA hack and I haven't yet found it necessary to
migrate to .Net interops etc. <g

although your code makes sense to me..



I'd test following:

clean the temp.
run your code.
check the temp.. and open the emf files to see what they are..
(and check that they are in fact generated by your code...


that's it for me..





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

Yes, in the TEMP folder. Sorry for not being specific.

To the best of my knowledge, I am not creating any embedded controls.

In my VB.NET app, I have the following commands:
xlbook.Close(False)
xlapp.Quit()
'Release the references we have

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlsheet)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlbook)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlapp)

Did I not close something properly?




"keepITcool" wrote in message
...

I assume you mean the EMF files generated by excel
in the temp folder?

These files are generated only/mostly?
for embedded controls on worksheets.

So your code may create sheets with embedded controls?


Either:
get rid of the embedded controls and replace
with native controls from the form toolbar.


close excel properly when your routine finishes.
when excel is closed (not Terminiated via API)
it should (and normally does) clear up any
mess left in the temp dir.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

I have a program that starts an instance of Excel 2002, creates a
spreadsheet, prints it, and closes. It does this roughly 400 times

a
day. As you can imagine, this means that a lot of .emf files are

going
to be created by Excel, and this can fill up a hard drive if left
unchecked. Is there a way to keep Excel from creating these files?

Thanks.
Joshua











Dave Peterson[_3_]

Excel 2002 and the .emf files
 
I use this VBS script to clean up my Temp folder on demand. I have a shortcut
to the script on my desktop.

http://groups.google.com/groups?thre...%40tkmsftngp02



Joshua Campbell wrote:

Apparently, the problem does lie in bad code. My code basically puts data
from an array into various cells, gives the worksheet a background, prints
the sheet, and closes. The mso*.emf file that is left is a copy of the
background image. Weird. Oh well. I'll probably just create a scheduled
task then to delete these files on a regular basis.

Thanks for your help!
Joshua

"keepITcool" wrote in message
...
I'm an old VBA hack and I haven't yet found it necessary to
migrate to .Net interops etc. <g

although your code makes sense to me..



I'd test following:

clean the temp.
run your code.
check the temp.. and open the emf files to see what they are..
(and check that they are in fact generated by your code...


that's it for me..





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

Yes, in the TEMP folder. Sorry for not being specific.

To the best of my knowledge, I am not creating any embedded controls.

In my VB.NET app, I have the following commands:
xlbook.Close(False)
xlapp.Quit()
'Release the references we have

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlsheet)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlbook)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlapp)

Did I not close something properly?




"keepITcool" wrote in message
...

I assume you mean the EMF files generated by excel
in the temp folder?

These files are generated only/mostly?
for embedded controls on worksheets.

So your code may create sheets with embedded controls?


Either:
get rid of the embedded controls and replace
with native controls from the form toolbar.


close excel properly when your routine finishes.
when excel is closed (not Terminiated via API)
it should (and normally does) clear up any
mess left in the temp dir.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Joshua Campbell" wrote:

I have a program that starts an instance of Excel 2002, creates a
spreadsheet, prints it, and closes. It does this roughly 400 times

a
day. As you can imagine, this means that a lot of .emf files are

going
to be created by Excel, and this can fill up a hard drive if left
unchecked. Is there a way to keep Excel from creating these files?

Thanks.
Joshua









--

Dave Peterson



All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com