Foxtable(狐表)用户栏目专家坐堂 → 打印格式设置 加了两行后 出现异常来自 HRESULT:0x800A03EC


  共有7551人关注过本帖树形打印复制链接

主题:打印格式设置 加了两行后 出现异常来自 HRESULT:0x800A03EC

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:112380 积分:572162 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/9/24 15:40:00 [显示全部帖子]

我电脑是win10,测试没有问题。做个例子发上来测试一下

Dim App As New MSExcel.Application
Try
    
    
    Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\问题\格式1.xls")
    Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
    With Ws.PageSetup
        .PrintArea = "A1:B4" '打印工作表的指定区域
        .PaperSize = MSExcel.XlPaperSize.xlPaperStatement
        .LeftMargin = 1 '页面左边距
        .RightMargin = 1 '页面右边距
        .TopMargin = 1 '页面顶部边距
        .BottomMargin = 1 '页面底部边距
        .CenterHorizontally = True '页面水平居中
        .CenterVertically = True '页面垂直居中
        .Orientation = MSExcel.xlPageOrientation.xlLandscape
    End With
    
    App.Visible = True
    Ws.PrintPreview
    
    wb.close(False)
    App.Quit
Catch ex As Exception 
    App.Quit
End Try 

 回到顶部