Dim xlApp As Excel.Application
Dim xlBook As Excel.WorkBook
Dim xlSheet As Excel.Worksheet
Dim sTxtFile As String sTxtFile = App.Path & "\white card.xls"
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Open(sTxtFile) '打开已经存在的EXCEL工件簿文件
xlApp.Visible = True '设置EXCEL对象可见(或不可见)
Set xlSheet = xlBook.Worksheets("Sheet1") '设置活动工作表
xlSheet.PrintPreview
xlsheet御览前必须 xlApp.Visible = True
请问有什么办法可以只御览,不使excel文件可见
Dim xlBook As Excel.WorkBook
Dim xlSheet As Excel.Worksheet
Dim sTxtFile As String sTxtFile = App.Path & "\white card.xls"
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Open(sTxtFile) '打开已经存在的EXCEL工件簿文件
xlApp.Visible = True '设置EXCEL对象可见(或不可见)
Set xlSheet = xlBook.Worksheets("Sheet1") '设置活动工作表
xlSheet.PrintPreview
xlsheet御览前必须 xlApp.Visible = True
请问有什么办法可以只御览,不使excel文件可见
不过你可以在后面加入
xlApp.Quit
这样用户就不用手动去关一下EXCEL了。