DTS ActiveX Task - VBScript Createobject("InternetExplorer.Application") issues

  • 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;" _

    & "Password Entry"_

    & " & " onkeypress=""if window.event.keycode=13 Then" _
    & " bboxwait=false"">

    " _

    & "&nbsp" & sPrompt & "&nbsp

    " _

    & "

    User: " _

    & "" _

    & "

    Password: " _

    & "

    " _

    & "" _

    & "

    ")

    .ParentWindow.document.body.style.borderStyle = "outset"

    .ParentWindow.document.body.style.borderWidth = "3px"

    .all.user.focus

    oIE.Visible = True

    'On Error Resume Next

    Do While .parentWindow.bBoxWait

    oIE.Visible = True

    if Err Then Exit Do

    Loop

    oIE.Visible = False

    if Err Then

    PasswordBox = "Error"

    Else

    PasswordBox = Split(.all.user.value & "|" _

    & .all.pass.value, "|")

    DTSGlobalVariables("" & sUservar & "") = .all.user.value

    DTSGlobalVariables("" & sPassvar& "") = .all.pass.value

    End if

    On Error Goto 0

    End With ' document

    End With ' IE

    End Function

    If anyone has any idea what is going on please let me know as I am stumped.

    Thanks,

    Matt

  • This was removed by the editor as SPAM

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply