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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Open and Save in Excel

Status
Not open for further replies.

ryupb

MIS
Aug 31, 2004
25
US
I have this question answered before in Word, however, I dint thought I will encounter this in excel...

How do I open an Excel file and later on saving it as a HTM file??
 
Excel - How to do Automation from VFP
faq184-4428

For an html file saveas try:

Code:
lcMyFile="test.xls"

loExcel=CREATEOBJECT("excel.application")
loExcel.Workbooks.Open(lcMyFile)
loExcel.visible=.t.
loExcel.ActiveWorkbook.SaveAs(juststem(lcMyFile),44)
loExcel.quit
 
Thanks Baltman..... will try it out now...
 
Baltman....

it seems that the saveas works ok.. however, is there a way where I can change the folder where the program will save the file???

currently the program is saving the file in the my documents folder....
 

Have you tried using the above suggestion with a fullpath?

Code:
lcMyFile="c:\test.xls"
loExcel=CREATEOBJECT("excel.application")
loExcel.Workbooks.Open(lcMyFile)
loExcel.visible=.t.
loExcel.ActiveWorkbook.SaveAs("c:\program files\myBook.xls")
loExcel.quit



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike.....

I tried using the full path.. however if i incorporate the full path to baltman's sample.. i encounter an error.... with regards to your sample.. I was trying to save the file as an htm file...

thanks......
 
Sorry... was away at work all day.

This should do it.

Brian

Code:
lcMyFile="c:\test.xls"
loExcel=CREATEOBJECT("excel.application")
loExcel.Workbooks.Open(lcMyFile)
loExcel.visible=.t.
loExcel.ActiveWorkbook.SaveAs(ADDBS(JUSTPATH(lcMyFile))+JUSTSTEM(lcMyFile),44)
loExcel.quit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top