Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel file doesn't close and exit Excel application
Message
From
22/10/2015 08:02:00
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
22/10/2015 00:29:57
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01626305
Message ID:
01626320
Views:
44
>Hi,
>I use VFP9 to create a excel file and export some data to the excel file and then
>want to Save it, close the worksheet and exit the Excel application.
>
>I find the oWorkbooks.SAVE and oWorkbooks.CLOSE command not work.
>also, use what statement to quit the Excel applcation ?
>
>The worksheet and the Excel application still open, when I close the Excel, it ask me to save the
>it or not, because the worksheet have modified.
>
>Please advise.
>
>
>ctargetfile = "c:\client.xls"
>EXPORT TO &ctargetfile TYPE XL5 FIELDS cusmas->cusno,cusmas->cusname
>TRY
>oExcel = CREATEOBJECT([Excel.Application])
>oWorkbook = oExcel.Workbooks.open(ctargetfile)
>oExcel.Visible = .t.
>WITH oExcel.activesheet
>          .PageSetup.Orientation = xlLandScape
>          .PageSetup.TopMargin =12
>          .PageSetup.LeftMargin =20
>          .PageSetup.BottomMargin =20
>          .PageSetup.RightMargin =15  
>          .Range("A1").value = "Client Code"
>          .Range("B1").value = "Client Name"
>          .Range("1:1").font.bold = .t.   
>....
>ENDWITH 
>oWorkbooks.Save(ctargetfile)
>oWorkbooks.Close
>CATCH
>  MessageBox([There is no EXCEL installed])
>ENDTRY
>
oExcel.quit(0)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform