以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [讨论]WIN10下代码导出出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=79881)

--  作者:易服
--  发布时间:2016/1/11 16:28:00
--  [讨论]WIN10下代码导出出错
WIN10下代码导出出错。WIN7下正常

此主题相关图片如下:代码导出.png
按此在新窗口浏览图片

If FileSys.DirectoryExists("D:\\My Documents\\Reports") Then \' 目录存在

Else

    FileSys.CreateDirectory("D:\\My Documents\\Reports") \'创建 目录

End If

Dim flg As New SaveExcelFlags

flg.MergedRanges = True

Tables("到村").SaveExcel("D:\\My Documents\\Reports\\到村.xls","到村",flg)

Dim Result As DialogResult

Dim App As New MSExcel.Application

Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\\My Documents\\Reports\\到村.xls")

Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)

Dim Rg As MSExcel.Range = Ws.UsedRange

Rg.Borders.Linestyle = MSExcel.XlLineStyle.xlContinuous  \'边框线型

Rg.Borders.Weight = MSExcel.XlBorderWeight.xlThin        \'边框粗细

Rg.Borders.ColorIndex = 1 \'边框颜色

Dim M As MSExcel.Range = Ws.Cells

M.EntireColumn.AutoFit   \'自动调整列宽

M.EntireRow.AutoFit      \'自动调整行高

App.Visible = True

Wb.Save

 


--  作者:大红袍
--  发布时间:2016/1/11 16:29:00
--  

1、

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=54396&replyID=360697&skin=1

 

2、如果1无法修复,就重新安装一下wps。


--  作者:易服
--  发布时间:2016/1/12 9:24:00
--  
原为office2007,按第一招方法无效,安装 WPS才解决
--  作者:大红袍
--  发布时间:2016/1/12 9:33:00
--  
 如果你电脑安装过wps,然后又装了ms office就有这种问题,需要重新安装wps