Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Save and Close Excel
Topic Summary:
Created On: 24-Feb-2006 22:44
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Carl Mattoon, on Monday, February 27, 2006 6:22 PM

Answer:
Tony,
That didn't quite do the job, but it set me in the right direction.  Here's what I found: 

This line had no affect.  When the script got to the "Close" statement, Excel asked if I wanted to save the changes.
oleMethod(activeSheet, "SaveAs", autoArgs)

I changed it to
oleMethod(activeWorkbook, "SaveAs", autoArgs)
Now Excel says this file exists, do I want to replace.

I further changed it to
oleMethod(activeWorkbook, "Save")

Now it works as expected.

Carl
 24-Feb-2006 22:44
User is offline View Users Profile Print this message


Carl Mattoon

Posts: 4
Joined: 10-Feb-2006

I've opened and modified an Excel spreadsheet from a dxl script using oleMethods, etc.  How do I save it and exit Excel?

Edited: 24-Feb-2006 at 23:33 by Carl Mattoon
Report this to a Moderator Report this to a Moderator
 27-Feb-2006 12:38
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Something like this should do it.
You will need to add some error checking etc etc...


OleAutoArgs autoArgs = null

autoArgs = create

clear(autoArgs)
put(autoArgs, "Your File Name")
oleMethod(activeSheet, "SaveAs", autoArgs)

// get a handle on the active workbook
oleGet(excelApplication, "ActiveWorkbook", activeWorkbook)

oleMethod(activeWorkbook, "Close")

// Quit Excel
oleMethod(excelApplication, "Quit")

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 27-Feb-2006 18:22
User is offline View Users Profile Print this message


Carl Mattoon

Posts: 4
Joined: 10-Feb-2006

Answer Answer
Tony,
That didn't quite do the job, but it set me in the right direction.  Here's what I found: 

This line had no affect.  When the script got to the "Close" statement, Excel asked if I wanted to save the changes.
oleMethod(activeSheet, "SaveAs", autoArgs)

I changed it to
oleMethod(activeWorkbook, "SaveAs", autoArgs)
Now Excel says this file exists, do I want to replace.

I further changed it to
oleMethod(activeWorkbook, "Save")

Now it works as expected.

Carl
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.