Foxtable(狐表)用户栏目专家坐堂 → 半Excel与VBA中使用Excel函数的问题


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

主题:半Excel与VBA中使用Excel函数的问题

帅哥哟,离线,有人找我吗?
yankunhao
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1016 积分:7135 威望:0 精华:0 注册:2008/9/1 22:34:00
半Excel与VBA中使用Excel函数的问题  发帖心情 Post By:2012/8/15 15:14:00 [只看该作者]

如有下面的代码,请问其中的"a = App.WorksheetFunction.RoundUp(Len(ws.range(s1)), 0)
"

有什么问题吗?

该语句主要是想计算Exce单元格中的字数的,但在说明文件中找不到用VBA如何调用Excel函数的相关内容.

 

 

Dim Book As New XLS.Book(ProjectPath & "Attachments\销售订单.xls")
Book.Build()
Dim s As String = Tables("osal_ord1").Current("sheet_no")
s = s.Replace("/"," ")
Book.Save(ProjectPath & "Reports\销售订单\" & s & ".xls")
Dim App As New MSExcel.Application
App.Visible = True
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(ProjectPath & "Reports\销售订单\" & s & ".xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim range As MSExcel.Range

Dim lastrow As Long
Dim rng As Integer
lastrow = Ws.usedrange.rows.count-13

rng = ws.range(Ws.cells(11,1),Ws.cells(lastrow,1)).entirerow.autofit
Dim r As Long
r =lastrow-11
Dim s1 As String = "B" & r
Dim a As Integer

a = App.WorksheetFunction.RoundUp(Len(ws.range(s1)), 0)
If a > 0 Then
ws.range(s1).RowHeight = 409
End If
Wb.Save


 回到顶部