Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Karben Selim Mejia
  Where is Karben Selim Mejia?
 San Pedro Sula
 Honduras
 Karben Selim Mejia
 To: Steve Bloodsworth
  Where is Steve Bloodsworth?
 Sarasota
 Florida - United States
 Steve Bloodsworth
 Tags
Subject: RE: Excel -- Saving (New Sheet)
Thread ID: 16120 Message ID: 16131 # Views: 2 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Wednesday, October 09, 2002 9:17:31 PM         
   


> > > When I am creating spreadsheets based on VFP tables, I generally format the spreadsheet after I export the raw data to it (resize columns, change fonts, add some borders and shading, etc.). The problem I am having is to save this modified spreadsheet without having the user prompted for anything. It seems that either it is asking if I want to save in the 5.0 format, or save it in the new 2000 format (XLAPP.SAVE), or asking me if I want to replace the file that already exists (XLSHEET.SAVEAS()).
> > >
> > > I just want to save it and quit.
> > >
> > > Any Ideas?
> > >
> > > Thanks,
> > >
> > > ~S
> >
> > Not pretty sure but this works for me
> >
> >
> > LOCAL oexcel as Excel.Application
> > 
> > oExcel = createOBJECT("Excel.application")
> > oExcel.Workbooks.Add()
> > oexcel.Visible = .T.
> > oexcel.Cells(1,1).Value = "test"
> > oexcel.ActiveWorkbook.SaveAs("test.xls")
> > 
> > 

> >
> > if the file already exist then you will have to test this before runnign the code and if the file exitts you have to delete it before saving the new one
> >
> >
> > Karben Selim Mejia
> >
> > I always have the last word in my home, "Yes sweet heart, what ever you say"
> >
> > Honduras, Central America
> > The very center of the world
>
>
>
> Great, thank you. I hadn't considered that I must rename/delete/re-save. Worked great, and apparently the SaveAS isn't prompting for new version save.
>
> One other thing. I'd like to have the 5 or so spreadsheets that I save put into one workbook as different sheets. I've tried getting the command to do this, but couldn't get past the SHEETS().MOVE command.
>
> Any help, again, would be appreciated.
>
> Thanks,
>
> ~Steve

Hey Steve, I don't think you are able to move a sheet to an existing Workbook, you can move it or copy it to a new workBook, plase somebody correct me if I am wrong!. i try to drag and drop the sheet, also with move or copy and I just couldn't; However I could think about it a little bit and the only answer came to my mind is this.
create a new workbook
open the workbooks that you have one single sheet on them one by one, select the sheet1, copy
then move the pointer to the new workbook and paste. something like this

LOCAL oexcel1 as Excel.Application, oexcel2 as Excel.Application

oExcel1 = createOBJECT("Excel.application")
oExcel2 = createOBJECT("Excel.application")
*:existing File with the sheet you want to pass to another workbook
oExcel1.Workbooks.Open("yourFirstXlsFile.xls")

*:The new xls file where you want to put all your sheets together
oExcel2.Workbooks.Add()

oexcel1.Visible = .T.
oexcel2.Visible = .T.

*:Here you will have to go in a For ... Endfor depending 
*:on the number of sheets (or xls files containing one single sheet)
*:you need to put together
WITH oExcel1
	*:Selecting the sheet to put it on the clipboard
    .Sheets("Sheet1").Select
	.Cells.Select
	.Selection.Copy
ENDWITH
*:Puting the cursor on the other workbook
WITH oExcel2    
	*:Making sure that is in the first sheet
	*:here you have to control if it is the sheet # 1, or # 2
    .Sheets("Sheet1").Select
    *:locating the cursor in the first cell
    .Range("A1").Select
    *:Pasting the content of the clipboard
    .ActiveSheet.Paste
ENDWITH


It is not pretty, maybe not the best way to do it, but the only one i have thought of so far

please let me know how it went

Karben Selim Mejia

I always have the last word in my home, "Yes sweet heart, what ever you say"
Honduras, Central America
The very center of the world

ENTIRE THREAD

Excel -- Saving (Safety Off) Posted by Steve Bloodsworth @ 10/9/2002 3:59:37 PM
RE: Excel -- Saving (Safety Off) Posted by Raymond Hartman @ 10/9/2002 5:04:03 PM
RE: Excel -- Saving (Safety Off) Posted by Karben Selim Mejia @ 10/9/2002 5:20:34 PM
RE: Excel -- Saving (New Sheet) Posted by Steve Bloodsworth @ 10/9/2002 6:08:05 PM
RE: Excel -- Saving (New Sheet) Posted by Karben Selim Mejia @ 10/9/2002 9:17:31 PM