BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Does anyone know when the OLE reference is to be released for EG 4.1.
I can find the VBscripting.dll within the EG4 program directory but I cannot add this as a reference to my VB project.
1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager
Lee,

Here is a preliminary version of the API reference:

http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting41.zip

It's a Microsoft HTML Help file (CHM) within a ZIP archive.

This gives you the full reference documentation, but might not be enough to get you started. If you post back with a question about what you are trying to do via automation, I'd be happy to try and provide an example.

Chris
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

16 REPLIES 16
ChrisHemedinger
Community Manager
Lee,

Here is a preliminary version of the API reference:

http://support.sas.com/documentation/onlinedoc/guide/SASEGScripting41.zip

It's a Microsoft HTML Help file (CHM) within a ZIP archive.

This gives you the full reference documentation, but might not be enough to get you started. If you post back with a question about what you are trying to do via automation, I'd be happy to try and provide an example.

Chris
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
deleted_user
Not applicable
Thanks, this may be useful to us later on, however the main issue we're having is referencing the EG4.1 scripting DLL (SASEGScripting.dll).

We're just trying to access EG using VBA, however the DLL does not appear to be registered with windows. When we attempt to add the file (from any VBA application go to tools -> references -> browse) it states "Can't add reference to specified file.".

Any idea what's wrong?

Cheers.
ChrisHemedinger
Community Manager
Lee,

Sounds like you would like to write code similar to the following:

Public Sub foo()
Dim objApp As SASEGScripting.Application
Dim objProject As SASEGScripting.Project

objApp = New SASEGScripting.Application
objProject = objApp.Open("myproject.egp", "")
objProject.Run
End Sub

This is an example of "early binding" code, which requires a reference to the EG scripting model exposed via COM. Most of our examples to date use VBScript and the "late binding" model, where you have a CreateObject("SASEGScripting.Application") call. Requires no COM reference, but the IDE doesn't help you with intellisense and such.

The SASEGScripting.dll is a .NET DLL, but it does expose a COM model. However, the type library required isn't registered by default. Here's how you can register it.

1. Open a command prompt window.

2. Run this command: (paths may vary depending on your installation)

c:\WINNT\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe /tlb:SASEGScripting.tlb /codebase "c:\Program Files\SAS\Enterprise Guide 4\SASEGScripting.dll"

Expected response:

Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Types registered successfully
Assembly exported to 'c:\Program Files\SAS\Enterprise Guide 4\SASEGScripting.tlb', and the type library was registered successfully

3. Run this command: (paths may vary depending on your installation)

"c:\Program Files\SAS\Shared Files\Integration Technologies\RegTypeLib.exe" "c:\Program Files\SAS\Enterprise Guide 4\SASEGScripting.tlb"

Expected response:

Registered c:\Program Files\SAS\Enterprise Guide 4\SASEGScripting.tlb

4. After these steps are completed, you should be able to Insert a reference to SAS Enterprise Guide 4.1 Object Library from your VBA application.

Chris
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
syyang
Calcite | Level 5

Hello Chris,

 

Though the last post is years ago, the topic is still very helpful.  I am working on the same task that control SAS EG project by SASEGScripting.Application, SASEGScripting.Project and other objects provided by SASEGScripting.dll.

 

Because I am using Excel VBA, I guess I need to register the COM dll and add it to reference before touching any real code. The question here is, I can not find below SASEGScripting.tbl file in my computer. I am using Win7 64bit and I could locate SASEGScripting.dll at C:\SAS94\SASEnterpriseGuide\7.1\.

 

Could you please help give some light on where to find and how to register the COM dll for EG 7.1?

 

Thanks,

Frank

CaseySmith
SAS Employee

Hi Frank,

 

The EGScripting.dll is installed and registered with Enterprise Guide, so you should not have to explicitly register it (or the tlb) if Enterprise Guide has already been installed on the machine. However, in addition to the other steps in this thread, if needed, you can also re-register the scripting dll by running "seguide.exe /register" (in the EG installation directory) from a command prompt (run as an administrator).

 

Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

syyang
Calcite | Level 5

Hello Casey,

 

Appreciate the quick reply.  Unfortunately, I am unable to execute "seguide.exe /register" as administrator at this moment.

 

May I have another question? Under current circumstance, will the reference from EGScripting.dll appear in VBA/Tools/Reference window and what is its displayed text? (I have never seen it before so I don't know what is the target look like).  I looked through the reference window but did not see anything similar. Maybe I missed something but I think if EGScripting.dll  is registered, it should appear there. 

 

Thanks and have a good day,

Frank

CaseySmith
SAS Employee

Hi Frank,

 

Actually, "seguide.exe /register" does not appear to be properly exporting and registering the type library (embedded in the SASEGScripting.dll) as I expected.  I confirmed it tries to (at least load/register), but was not working for me.  I'll have to investigate that separately.

 

So, I had to follow the steps Chris posted to manually export and register, and they worked for me (on 32-bit EG 7.15)...

 

Here is the exact command I used (run in a Windows command prompt as an administrator) (you may have to update it with your EG installation and .NET Framework directory paths):

 

C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /tlb:"C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\SASEGScripting.tlb" /codebase "C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\SASEGScripting.dll"

 

And the output confirming proper export and registration...

C:\Windows\system32>C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /tlb:"C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\SASEGScripting.tlb" /codebase "C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\SASEGScripting.dll"
Microsoft .NET Framework Assembly Registration Utility version 4.7.2556.0
for Microsoft .NET Framework version 4.7.2556.0
Copyright (C) Microsoft Corporation. All rights reserved.

Types registered successfully
Assembly exported to 'C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\SASEGScripting.tlb', and the type library was registered successfully

 

Them run Chris' step #3 in the same command window.  Here is the exact command I used:

 

"C:\Program Files\SASHome\x86\Integration Technologies\RegTypeLib.exe" "C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\SASEGScripting.tlb"

 

Note: If you have 64-bit EG, use the 64-bit RegTypeLib.exe instead.  For example:
"C:\Program Files\SASHome\Integration Technologies\RegTypeLib.exe" "C:\Program Files\SASHome\SASEnterpriseGuide\7.1\SASEGScripting.tlb"

 

Then, when I open VBA References in Excel, SASEGScripting appears and can be used...

 

SASEGScriptingInVbaReferences.png

 

Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

syyang
Calcite | Level 5

Hello Casey,

 

Thanks for the light, it's beautiful.  I noticed the usage of RegAsm.exe from .NET directory... Anyway, I have to find the administrator permission and .NET library for me first. 

 

Thanks again,

Frank

deleted_user
Not applicable
Chris,
Thanks for the quick response. This is exactly what I needed. I've now registered the Files and can now reference the SASEGScripting dll.
deleted_user
Not applicable
Chris,
Although I can now reference the scripting DLL when I run the following code

Dim objApplication
Set objApplication = CreateObject("SASEGscripting.Application")
I get an error :-
Run-time erro '429' Activex componet can't create object.

Do you have any ideas why this may not be working?

Lee
deleted_user
Not applicable
Sorrry, the code was actually

Set objApplication = CreateObject("SASEGObjectModel.Application")
ChrisHemedinger
Community Manager
Lee,

For EG 4.1 you want to use this prog ID:

Set objApplication = CreateObject("SASEGObjectModel.Application.4")

You can get a quick example by going to Tools->Schedule Project. This will bring up the Windows scheduler dialog, which you can cancel. Then you'll have a VBScript file referenced in your project that performs a simple automation task of running the project.

Chris
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Vladislav
Calcite | Level 5

Dear Chris,

I wanted to check out automation functionality of SAS EG 6.1 via VBA. As any attempts to create Application object led to an error, I've tried to register SASEGScripting.dll via regasm.exe and to create the tlb file following the 4 steps you've described. On the second step, however, I've got the following error: "RegAsm : error RA0000 : Type library exporter encountered an error while processing 'SAS.EG.Scripting.ISASEGContainerCollection, SASEGScripting'. Error: Type 'ISASEGContainerCollection' and type 'ISASEGOutputDatasets' both have the same UUID." After that VBA code started to work with late binding approach, but early binding still fails. Is there any way to resolve this RegAsm error?

Thanks in advance.

ChrisHemedinger
Community Manager

With EG 6.1, you should be able to run:

  SEGuide.exe /register

And have the automation API become registered, if it isn't already.

And the scripting API and examples can be found in this sasCommunity.org article:

http://www.sascommunity.org/wiki/Not_Just_for_Scheduling:_Doing_More_with_SAS_Enterprise_Guide_Autom...

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 16 replies
  • 3721 views
  • 0 likes
  • 6 in conversation