Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From vfp side if i have to open an excel file and close it

Status
Not open for further replies.

suha

Programmer
Aug 19, 2000
41
JO
hello

i have a form that needs to open an excel file thru acitivating excel application but the problem i have when i quit Excel a message appears to ask save the changes on this file or not?
i don't need to save this file i use it as an intermediate so if there is a way to not having this message and discard the changes i do on this file tell me which command to use???


thanks,
suha [sig][/sig]
 
hello again

to be specific here is the method i use in my form:
1.close data all
2.oexcel=createobject('excel.application')
3.use xx in 1 alias xx
4.select xx
5.COPY TO "c:\my documents\book5.xls" TYPE XL5
6.oexcel.Workbooks.open('c:\my documents\book5.xls')
7.oexcel.Workbooks.open('c:\my documents\book6.xls')
8.use yy in 2 alias yy
9.select yy
10.thisform.oleboundcontrol1.controlsource=""
11.thisform.oleboundcontrol1.controlsource="yy.graph"
12.thisform.oleboundcontrol1.visible=.t.
13.oExcel.quit
14.release oExcel

the problem at no.13 when i have to quit excel this message appears "do you want to save changes in books??"
i don't want the user to get this message as in my situation i don't need that this file to be saved.

is there a way that this message doesn't appear???? [sig][/sig]
 
This is one way ...

if file("JUNK.XLS")
erase junk.xls
endif

oWorkbook.saveas("JUNK.XLS")
oExcel.quit()

Since you have already saved it, excel will not ask the question.

Good Luck.


[sig]<p>Don<br><a href=mailto:dond@csrinc.com>dond@csrinc.com</a><br><a href= > </a><br> [/sig]
 
Hi Suha,

13.oExcel.ActiveWorkBook.Close(.F.)
14.oExcel.quit
15.release oExcel [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>The World Is Headed For Mutiny.....When All We Want Is Unity. - Creed[/sig]
 
hello
thanks
using &quot;oExcel.ActiveWorkBook.Close(.F.)&quot; works fine with me but the same thing in line no. 5 after copy the file to book5.xls a message appears to ask overwrite it or not how can i overwrite it directy that this message doesn't appear

thanks

suha
[sig][/sig]
 
SET SAFETY OFF [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>The World Is Headed For Mutiny.....When All We Want Is Unity. - Creed[/sig]
 
THANKS JON

I TRIED IT AND IT WORKS FINE.

SUHA [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top