Google
 
Web itpro-blogger.blogspot.com
月曜日, 2月 01, 2010

[VBA]IADsで「オートメーション エラーです。エラーを特定できません」のエラーがでる

▼質問
Active Directory(Active DS Type Libray)のPutメソッドを使って

下記の関数を作ったら次のエラーが出る。



Private Sub SetIADsValue(ByVal IADs As Object,
ByVal PropertyItem As String,
ByVal PropertyValue As String)

On Error GoTo doError

IADs.Put PropertyItem, PropertyValue

Exit Sub

doError:
Debug.Print (Err.Description & "(" & Err.Number & ")")
End Sub





「オートメーション エラーです。エラーを特定できません (-2147467259)」

どうしてなんだ。

▼回答
PutメソッドのPropertyValue値の型がVariantじゃないと出るエラーなんだ。

IADs.Put PropertyItem, PropertyValue

だから、次の様にしないといけないんだ。

Private Sub SetIADsValue(ByVal IADs As Object, ByVal PropertyItem As String, ByVal PropertyValue As Variant)






Comments: コメントを投稿

<< Home

This page is powered by Blogger. Isn't yours?