相关疑难解决方法(0)

如何在vba宏中检查空数组

我想检查空数组.Google给了我各种解决方案,但没有任何效果 也许我没有正确应用它们.

Function GetBoiler(ByVal sFile As String) As String
'Email Signature
    Dim fso As Object
    Dim ts As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
    GetBoiler = ts.ReadAll
    ts.Close
End Function

Dim FileNamesList As Variant, i As Integer
' activate the desired startfolder for the filesearch
FileNamesList = CreateFileList("*.*", False) ' Returns File names
' performs the filesearch, includes any subfolders
' present the result
' If there are Signatures then populate SigString
Range("A:A").ClearContents
For i = …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

57
推荐指数
6
解决办法
19万
查看次数

如何确定是否在VB6中初始化了一个数组?

将未扩展的数组传递给VB6的Ubound函数将导致错误,因此我想在检查其上限之前检查它是否已被标注尺寸.我该怎么做呢?

arrays vb6

52
推荐指数
6
解决办法
5万
查看次数

VBA数组长度(不是ubound或onerror!)

很抱歉问这样一个基本问题,但这让我很生气......

VBA中的哪个函数返回数组中的元素数...即当数组为空时它将返回0?

我不能用UBound做这个,因为它在一个空数组上调用时抛出一个错误,我不能相信通过使用OnError来首先确定它是否为空的方式来做到这一点......就像在论坛上建议的那样!array.Length抱怨一个糟糕的限定符或其他东西.

我真的需要这样做:

dim termAry() as String
populate termAry
...

private sub populate(terms() as String)
   redim preserve terms(terms.Length) ' Redim takes ubound for array size
   terms(ubound(terms)) = "something really annoying"
end sub
Run Code Online (Sandbox Code Playgroud)

PS任何良好的链接到一个简洁的VBA语言和函数参考将是最有用的... MSDN似乎真的很模糊!

ms-access vba

8
推荐指数
1
解决办法
4万
查看次数

使ScriptControl与Excel 2010 x64一起使用

我尝试使用给予解决这个,但是,每当我尝试运行最基础的东西,我得到一个Object not Defined错误.我认为这将是我的错(没有安装ScriptControl).但是,我尝试按此处所述进行安装,但无济于事.

我正在使用Office 2010 64位运行Windows 7 Professional x64.

com vba excel-vba scriptcontrol excel-2010

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

vba ×3

excel-vba ×2

arrays ×1

com ×1

excel ×1

excel-2010 ×1

ms-access ×1

scriptcontrol ×1

vb6 ×1