dim xlsheet as excel.worksheet ..... ..... xlsheet.PrintPreview
如下测试通过 Private Sub Command1_Click() Dim xlapp As Excel.Application Dim xlsheet As Excel.Worksheet Set xlapp = New Excel.Application xlapp.Workbooks.Add Set xlsheet = xlapp.ActiveSheet xlapp.Visible = True xlsheet.Range("A1") = "kkkkkkk" xlsheet.PrintPreview End Sub
.....
.....
xlsheet.PrintPreview
Private Sub Command1_Click()
Dim xlapp As Excel.Application
Dim xlsheet As Excel.Worksheet
Set xlapp = New Excel.Application
xlapp.Workbooks.Add
Set xlsheet = xlapp.ActiveSheet
xlapp.Visible = True
xlsheet.Range("A1") = "kkkkkkk"
xlsheet.PrintPreview
End Sub