Hello to all valued forum members!

Over the last year or so, I have received some valuable help from various members.

I thought it was my turn to contribute by posting some code I developed in relation to the chemdraw add-in for excel. For anyone who uses this add-in, you probably have noticed that cambridgesoft offer pretty poor technical advice on its use, and information from excel forums appears to be rather limited.

I wanted to create a macro in which I could call on the various functions found in the add-in commandbar without having to resort to using sendkeys. (sendkeys method did work, but was unreliable). This was done in Excel 2003.

In order to reference the various add-in applications, one needs to know the individual application names. I used this great tool to figure it out:

http://erlandsendata.no/?p=2694

Some examples are as follows:

1. To convert a smiles string into a structure: CFxlDoConvertSMILES
2. To display the structure as a picture: CFxlDoShowPicture
3. To edit a structure in chemdraw: AddOrEditMolecule

As far as my code was concerned, what I wanted to do was to generate (and display) a chemdraw structure from its corresponding smiles string. The smiles string was referenced as a LOOKUP from a master template database, in which 100's of smiles strings had been previously entered. Lastly, I wanted to be able to refresh the structure with a new structure at any time using the same macro.

In this particular case, the LOOKUP value resides in cell N20, and the structure is displayed in cell F13.

My code is as follows:

Please Login or Register  to view this content.

That's it! Fairly simple stuff, yet very difficult to find in the beginning!

Hopefully others can benefit from this!

Cheers,

bubastisbastet.