MS Access无法识别“经典”VBA功能

时间:2015-08-31 14:15:04

标签: forms vba subprocess libraries

我使用以下函数垂直对齐表单中的标签。

Private Sub VerticallyCenter(ctl As control)
    Dim lngHeight As Long
    lngHeight = fTextHeight(ctl)
    ' Rounding will result in a 1 to 2 pixel margin of error
    ' of every control before it renders text.
    ctl.TopMargin = ((ctl.Height - lngHeight) / 2)
End Sub

但是,当我编译它时,它表示没有定义fTextHeight()。我在其他“经典”VBA Access函数上遇到与DirectCast()或CType()相同的错误。看起来我的Access没有加载VBA库。

1 个答案:

答案 0 :(得分:1)

发现它!

就像我说的,fTextHeight是一个自定义功能。它包含在可从此处下载的压缩.mdb模块modTextHeightWidth中:http://www.lebans.com/textwidth-height.htm