Sign in to follow this  
Followers 0
Akshay07

How can I save "silently"an excel object created by ObjCreate( "Excel.Application" )

5 posts in this topic

Hi all,

I have an excel document that I open using the statement:

ObjCreate( "Excel.Application" )

I would like to save it silently.

I tried

$oExcel.Application.Save

but it is not "silent" (it's actually trying to save a copy).

Any hint?

Thanks!

Share this post


Link to post
Share on other sites



What do you mean by "silent?" I would assume you mean in the background without a shown window, etc. But I also don't see what you're saying with "it's actually trying to save a copy," could you elaborate more if possible?


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

OK, I will give more details.

The excel spreadsheet is opened and visible, but I do not want to have to activate it to write into it.

IF I try to use the $oExcel.Application.Save statement, it is opening a dialog box in the excel window, just like if I was doing "Save as" manually.

Let's assume that the excel spreadsheet name is "MyExcel.xls"

I will open it using

$oExcel = ObjCreate( "Excel.Application" )
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open ("C:\MyExcel.xls" )

Then, if I try to use

$oExcel.Application.Save

the window dialog box "save as" is displayed. This is what I want to bypass. I would like to save the spreadsheet without having any window dialog box.

Let me know if you need more details, I can get a screen capture.

Thanks!

Edited by Akshay07

Share this post


Link to post
Share on other sites

Okay, well I just spent ~1 minute on MSDN looking at the Excel object and found this:

http://msdn.microsoft.com/en-us/library/h1e33e36%28VS.80%29.aspx

Look at the parameters they use for the SaveAs method and try that.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

Thanks.

The problem was actually somewhere else. Due to a wrong object handling, the spreadsheet was opened in read only mode. But it is fixed now.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0