I am trying to set an ActiveX task so that it displays a login window for the user to type in a username and password. I am using a bit of VBScript that works when i execute the step on its own, but not when the whole package is executed. Can anyone explain to me why this is happening and how i can get around it.
The error message i get when i attempt to run the whole package is:
Error Code: 0
Error Source: Microsoft VBScript runtime error
Error Description: Class doesn't support automation: 'ParentWindow'
Error on line 42
The code I am using for the step is:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
DTSGlobalVariables("srcServer") = InputBox("Input a Source Server")
DTSGlobalVariables("srcDB") = InputBox("Input a Source Database")
SrcTrustedConnection = msgbox("Does the Source need a special login?",vbyesno)
DTSGlobalVariables("srcTrustCon") = -1
if SrcTrustedConnection = vbyes then
DTSGlobalVariables("srcTrustCon") = 0
'msgbox "Please Click on the blinking command input in the Taskbar after clicking OK", vbokonly
sPwd = PasswordBox("Enter your Username and Password for the Source Server","sa","srcUser","srcPass")
end if
DTSGlobalVariables("dstServer") = InputBox("Input a Destination Server")
DTSGlobalVariables("dstDB") = InputBox("Input a Destination Database")
DestTrustedConnection = msgbox("Does the Destination need a special login?" & vbcrlf & vbcrlf,vbyesno)
DTSGlobalVariables("destTrustCon") = -1
if DestTrustedConnection = vbyes then
'msgbox "Please Click on the blinking command input in the Taskbar after clicking OK", vbokonly
DTSGlobalVariables("destTrustCon") = 0
sPwd = PasswordBox("Enter your Username and Password for the Destination Server","sa","destUser","destPass")
end if
Main = DTSTaskExecResult_Success
End Function
Function PasswordBox(sPrompt, sDefault,sUservar,sPassvar)
dim oIE
set oIE = CreateObject("InternetExplorer.Application")
With oIE
.ToolBar = False
.RegisterAsDropTarget = False : .Navigate("about:blank")
With .document
With .ParentWindow
If Instr(.navigator.appVersion, "MSIE 6") = 0 Then
oIE.FullScreen = True
.resizeto 400,180
.moveto .screen.width/2-200, .screen.height/2-90
Else
.resizeto 400,230
.moveto .screen.width/2-200, .screen.height/2-115
End if
End With
.Write("
<" & "script>bboxwait=true;" & "script>" _
& "
Password Entry"_
& "
If anyone has any idea what is going on please let me know as I am stumped.