VBA里头是这样实现的
Sub Macro1()
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
ActiveWindow.SelectedSheets.PrintPreview
End Sub以下是我写的Delphi函数,卡住了,希望帮忙
function PrintPreview(fileName:string):integer;
var ExcelApp:variant;
begin
ExcelApp:=CreateOleObject('Excel.Application');
ExcelApp.visible:=true;
ExcelApp.workBooks.Open(fileName);
{这里就不会写了,希望帮忙}
//excelApp.WorkSheets[ExcelApp.Array('sheet1','sheet2')].Select;
ExcelApp.ActiveWindow.SelectedSheets.PrintPreview;
Result:=1;
end;
分不多,望能得到您的帮助
Sub Macro1()
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
ActiveWindow.SelectedSheets.PrintPreview
End Sub以下是我写的Delphi函数,卡住了,希望帮忙
function PrintPreview(fileName:string):integer;
var ExcelApp:variant;
begin
ExcelApp:=CreateOleObject('Excel.Application');
ExcelApp.visible:=true;
ExcelApp.workBooks.Open(fileName);
{这里就不会写了,希望帮忙}
//excelApp.WorkSheets[ExcelApp.Array('sheet1','sheet2')].Select;
ExcelApp.ActiveWindow.SelectedSheets.PrintPreview;
Result:=1;
end;
分不多,望能得到您的帮助
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货