BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
elwayfan446
Barite | Level 11

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.

 

error.jpg

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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.

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

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.

elwayfan446
Barite | Level 11

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?

AlanC
Barite | Level 11
Most likely not. Perhaps another program installation. VBS will have a dll dependency. A reinstall probably put the dependency back in there but normally MS doesn't break the dependency on a reinstall.

I would still suggest putting in more error checks into the script.
https://github.com/savian-net
AlanC
Barite | Level 11

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. 

https://github.com/savian-net

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1156 views
  • 1 like
  • 3 in conversation