I have an issue where a vbs file generated by a scheduler runs find on my PC but not a co-workers PC. I have searched the web and haven't had any luck with the reason behind it. Below is the error I am getting and the vbs that it is calling.
Option Explicit
Dim app ' As SASEGuide.Application
Call dowork
'shut down the app
If not (app Is Nothing) Then
app.Quit
Set app = Nothing
End If
Sub dowork()
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----
Dim prjName ' As String
Dim prjObject ' As SASEGuide.Project
Dim containerName ' As String
Dim containerObject ' As SASEGuide.Container
Dim containerColl ' As SASEGuide.ContainerCollection
prjName = "M:\NECD\Group\PFS\mortgage\MSR Reporting\MSR Acquisitions Reporting\SAS EG Projects\SAS EG Manual Projects.egp" ' Project Name
containerName = "MSR0002 - MSR FHLMC CRX Reporting" ' Container Name
Set app = CreateObject("SASEGObjectModel.Application.8.1")
If Checkerror("CreateObject") = True Then
Exit Sub
End If
Set prjObject = app.Open(prjName,"")
If Checkerror("App.Open") = True Then
Exit Sub
End If
Dim orderedListContainer
Dim orderedList
'-----
'Run the ordered list
'-----
Set orderedListContainer = prjObject.ContainerCollection.Item("Ordered Lists")
For Each orderedList in orderedListContainer.Items
If orderedList.Name = "MSR0002_CSV" Then
orderedList.Run()
End If
Next
If Checkerror("OrderedList.Run") = True Then
Exit Sub
End If
'-----
' Save the new project
'-----
'prjObject.Save
'If Checkerror("Project.Save") = True Then
' Exit Sub
'End If
'-----
' Close the project
'-----
prjObject.Close
If Checkerror("Project.Close") = True Then
Exit Sub
End If
End Sub
Function Checkerror(fnName)
Checkerror = False
Dim strmsg ' As String
Dim errNum ' As Long
If Err.Number <> 0 Then
strmsg = "Error #" & Hex(Err.Number) & vbCrLf & "In Function " & fnName & vbCrLf & Err.Description
MsgBox strmsg 'Uncomment this line if you want to be notified via MessageBox of Errors in the script.
Checkerror = True
End If
End Function
I am assuming it has something to do with my co-workers pc since it runs fine on mine but not sure what to look for.
I'd suggest a de-install then a re-install of EG on your co-worker's PC. If that doesn't fix it, track it with Tech Support.
I'd suggest a de-install then a re-install of EG on your co-worker's PC. If that doesn't fix it, track it with Tech Support.
This fixed it, although a pain. Not sure how hers was working a week ago and then it wasn't today. Wondering if a windows update had anything to do with it?
The code seems to be failing on this check:
If orderedList.Name = "MSR0002_CSV" Then
orderedList.Run()
End If
I would check that you colleague has security rights to where the file is located. I would also make sure they have same version of SAS. Check in their installed apps that they also contain the correct Microsoft VC++ libraries (hunch on my part).. Make sure the libraries match yours.
Finally, longer term, move away from VBS if possible. For now, put in additional error checks to look for mull values at key steps so you can isolate where the problem is occurring. My guess is that it is further up the food chain from where the code is reporting it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.