I have the following vbscript, running as an activex script inside a DTS package:
Function Main()
Set OpenFileDialog = CreateObject("MSComDlg.CommonDialog")
With OpenFileDialog
.DialogTitle = "Select Data Source"
.Filter = "All Files|*.*"
.FilterIndex = 4
.MaxFileSize = 1024
.InitDir = "S:\NBC\GC\CDRs\"
.ShowOpen
End With
MyStr = OpenFileDialog.FileName
MyChrPos = InStrRev(MyStr, "\")
MyStrLen = Len(MyStr)
MyFileName = Mid(MyStr, (MyChrPos + 1), (MyStrLen - MyChrPos))
If Left(MyFileName, 4) = "ETRF" Then
MyCarrierName = "Global Crossing"
ElseIf Left(MyFileName, 19) = "GC Switched Inbound" Then
MyCarrierName = "Global Crossing"
Else
MyCarrierName = InputBox("Enter Name of Carrier:", "Carrier Name" )
End If
MyEMRFileName = InputBox("Enter EMR filename:", "EMR File For Billing" )
DTSGlobalVariables("gVarData_Source").Value = MyStr
DTSGlobalVariables("gVarImport_File").Value = MyFileName
DTSGlobalVariables("gVarEMR_File").Value = MyEMRFileName
DTSGlobalVariables("gVarCarrier_Name").Value = MyCarrierName
Main = DTSTaskExecResult_Success
End Function
This runs fine on my workstation, but will not run on a different workstation in our office. Doesn't matter if I am logged in or someone else is. I installed script debugger, and it is erroring out on the first line of code. It is not telling me specifically what the error is though. It seems to me that for some reason on that machine it cannot handle the code for opening the file open dialog box.
Also if I put in the line On Error Resume Next at the top of the code, then it skips the first part of the code and then continues on correctly with the inputbox prompts. So It seems to me that for some reason on that machine it cannot handle the code for opening the file open dialog box.
Is there any setting or settings I can change on this other computer so that it can correctly run this part of the code?
Thank you for your help,
Kevin
Function Main()
Set OpenFileDialog = CreateObject("MSComDlg.CommonDialog")
With OpenFileDialog
.DialogTitle = "Select Data Source"
.Filter = "All Files|*.*"
.FilterIndex = 4
.MaxFileSize = 1024
.InitDir = "S:\NBC\GC\CDRs\"
.ShowOpen
End With
MyStr = OpenFileDialog.FileName
MyChrPos = InStrRev(MyStr, "\")
MyStrLen = Len(MyStr)
MyFileName = Mid(MyStr, (MyChrPos + 1), (MyStrLen - MyChrPos))
If Left(MyFileName, 4) = "ETRF" Then
MyCarrierName = "Global Crossing"
ElseIf Left(MyFileName, 19) = "GC Switched Inbound" Then
MyCarrierName = "Global Crossing"
Else
MyCarrierName = InputBox("Enter Name of Carrier:", "Carrier Name" )
End If
MyEMRFileName = InputBox("Enter EMR filename:", "EMR File For Billing" )
DTSGlobalVariables("gVarData_Source").Value = MyStr
DTSGlobalVariables("gVarImport_File").Value = MyFileName
DTSGlobalVariables("gVarEMR_File").Value = MyEMRFileName
DTSGlobalVariables("gVarCarrier_Name").Value = MyCarrierName
Main = DTSTaskExecResult_Success
End Function
This runs fine on my workstation, but will not run on a different workstation in our office. Doesn't matter if I am logged in or someone else is. I installed script debugger, and it is erroring out on the first line of code. It is not telling me specifically what the error is though. It seems to me that for some reason on that machine it cannot handle the code for opening the file open dialog box.
Also if I put in the line On Error Resume Next at the top of the code, then it skips the first part of the code and then continues on correctly with the inputbox prompts. So It seems to me that for some reason on that machine it cannot handle the code for opening the file open dialog box.
Is there any setting or settings I can change on this other computer so that it can correctly run this part of the code?
Thank you for your help,
Kevin