question

Upvotes
Accepted
5 0 1 0

Redi Excel VBA, late-binding Redi Type Library

Hello, I was given example Excel VBA code to automate Redi order entry. It works by creating a new object of type "Order", like this:

set hOrder = new Order

I need a late-binding equivalent to this code, but I cannot determine the proper qualified classname to pass to the CreateObject method. When I try this:

set hOrder = CreateObject("RediLib.Order")

I get the error message: "ActiveX component can't create object"

I believe I must be using the wrong qualified-name. Can you please inform me how to do this? I need this code late-binding so it will compile (but not work, which is fine) on machines without Redi Type Library.

Thank you,

-Benny

redi-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@3843399e-a0b7-4273-83ff-78596d2e1c98

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvotes
Accepted
32.2k 40 11 20

Hi @3843399e-a0b7-4273-83ff-78596d2e1c98,

Yes, able to create object. And to verify myself, I just went and again created

Dim hOrder
Set hOrder = CreateObject("REDI.ORDER")

Now, trying to think why it may not work for you.

Static order creation works for you, so REDI library is installed on your machine.

Have you updated REDI lately?

You may need to re-register using api.reg file as discussed in REDI Quickstart.

After you do, restart Excel before testing.

To explain my thinking on what may be missing:

  • REDI tlb should be present
  • Added as reference to project (if any shade of doubt, uncheck reference and re-add it via "browse")
  • Registered via REG into windows registry (see Quickstart step 5)

Let us know how this works for you?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
32.2k 40 11 20

Hello Benny @3843399e-a0b7-4273-83ff-78596d2e1c98,

Try

set hOrder = CreateObject("REDI.ORDER")
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi Zoya thank you very much. Unfortunately I have tried that, and get the same error. Is it possible there is another name? One other question, I have only referenced the "Redi 1.0 Type Library" from this VBA project. Do you think I need some other reference to be able to instantiate the Order in this way? Thank you again for the help.

-Benny

Hi Benny @3843399e-a0b7-4273-83ff-78596d2e1c98,

In my thinking, as you are able to reference the library in "New Order" call, you should have it installed and referenced properly.

Could you please confirm, if your REDIPlus was running and logged in, when you have tested?

Hi Zoya. Yes, I can confirm, REDIPlus was running and logged in when I did my test. I understand what you said, that if the library is referenced properly, the code "new Order" will work fine. However, I need to write code which works on systems which do not have the REDIPlus plugin. The code itself can (and should) fail to execute, because REDI is missing; however, the code must be able to *compile*, which is not possible with the "static type" approach you suggest. I need to use "CreateObject". Can you confirm your code CreateObject("REDI.ORDER") works on your system?

Upvotes
5 0 1 0

Hello Zoya, thank you very much for all the help with this. Your last ideas were very helpful, and I was able to resolve the issue.

Details:

I was not able to access the Quickstart link, because I am not an "API Family Member" even though I have requested the membership a few times. However, I was able to find that document elsewhere.

Unfortunately, I was also not able to access the "api.reg" file, as I do not know the credentials for that FTP resource (ftp://ftp.slk.com/sdk.reg).

Finally, the Quickstart guide recommended the "Install Excel Add-In" action from "Tools" in the Redi Login window. Although I already had the add-in installed, when I ran that installer (which presumably also executes the Registry modification), I was then able to create the object Dynamically per your example.

Thank you again very much for this help.

Regards,

-Benny

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello Benny @3843399e-a0b7-4273-83ff-78596d2e1c98,

Thanks for keeping us informed.

I have asked to check on REDI family approval.

Quickstart guide step 5 includes the credentials for FTP, together with the address.

When REDI version is updated next time, you may need to re-register again.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.