Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Print Preview
Message
From
01/08/2008 10:56:01
 
 
To
01/08/2008 02:54:33
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01335743
Message ID:
01335810
Views:
18
>I use Excel 2000 as a reporting tool through automation. If a user selects to Preview a Report, I know how to bring it up in the Excel PREVIEW window. When the user closes the Preview window, excel usually reverts to Normal View. Is it possible to close Excel at this point and prevent this behavior so that the user is returned back to the application (VFP) ?
>
>
>Thanks in advance
>
>Fred Matano

When you issue ExcelWorkbook.PrintPreview from VFP application, the latter stops execution and waits for user to close Preview window, either by printing or by returning to 'Normal View'. It means that you can just close Excel from VFP when it regains control, see this example:
oExcel=CREATEOBJECT('Excel.Application')
with oExcel
  .Visible=.t.
  .Workbooks.Add
  .ActiveWorkbook.Sheets(1).Cells(1,1).Value='test'    && just to print something
  .ActiveWorkbook.PrintPreview
*** VFP stopped here and waits for Excel to finish 'preview' mode
  .DisplayAlerts=.F.
  .Quit
endwith
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform