BookmarkSubscribeRSS Feed
DpDiane
Calcite | Level 5

Hi,

Can somebody tell me what is wrong with the code below?  It wont run manually or with the task scheduler.  It has worked in the past but stopped working for some reason.

Any help would be much appreciated.

Option Explicit
Dim app
Dim container
Dim orderedList
Dim n
Dim p


Call dowork

If not (app Is Nothing) Then
    app.Quit
    Set app = Nothing
End If


Sub dowork()
    On Error Resume Next
    Dim prjName
    Dim prjObject

    prjName = "C:\My Data\ReportDocs_DRC_Daily_Sales\SAS_DailySales.egp"
     
    Set app = WScript.CreateObject("SASEGObjectModel.Application.4.3")

    Set prjObject = app.Open(prjName,"")

    Set container = prjobject.ContainerCollection

    For n=0 to (container.Count -1)

                if container(n).ContainerType = 5 then
                Set orderedList = container(n).Items
                  for p=0 to (orderedList.Count -1)
                                orderedList(p).run
                  Next
                end if
    Next

    prjObject.run
    prjObject.Save
    prjObject.Close
      
End Sub

4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12

"Doesn't run" is pretty broad.  Any specifics?  I'm not a VB programmer, so I can't help on the specifics of the code.

In general, if something that used to run, stops running, I look for changes in the environment.  Can you still run any scheduled tasks?  Perhaps IT removed or restricted  that capability for users.  New OS?  Other new software?

DpDiane
Calcite | Level 5

Hi,

The script use to run on my old laptop with Windows 7 but recently upgraded to a new machine.  The script opens the SAS query, closes and saves it but doesnt run the actually query.  i can tell because the time on the query has changed.  Could it be a system setting I need to change?

Any help would be great.

Thanks,

Diane

Doc_Duke
Rhodochrosite | Level 12

See if you can run anything from vb?

See if you can run an EG project with the scheduler?

Then get up with your IT support folks.

DpDiane
Calcite | Level 5

I have escalated this to the IT Folks as I think it could be an system setting on my laptop.  I can run it on my old laptop no problem.

Thanks so much for your help.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2249 views
  • 0 likes
  • 2 in conversation