Sunday, October 10, 2010

Playing OLE

Many times programming for ole_objects is a tedious job. creating a object and checking help on it. and trying on emacs .

But there is a shortcut which will make the life easy while working with excel, word, powerpoint from magik.

Microsoft Office comes with macro recorder and editor(VBA Editor) which will do 70% of our work if we trying to add something to office applications from magik.

for eg: I have to add table to the MS word. but dont know how?? Macros will help a lot... here is the example

Step 1: Start office App( word, excel, Powerpoint) i use MS word here.
Step 2: Go to Tools -> Macro -> Record New Macro.
Step 3: Give the name to Macro (Tablemac). Slect "OK" (Fig 1)
Step 4: Go to Table -> Insert -> Table and select "OK".
Step 5: Select Stop Recording . (fig 2)
Step 6 : Go to Tools -> Macro -> Macros (Alt+F8)
Step 7. Select the Macro and click Edit. This will opens the VB Editor with the code for inserting Table to MS word. as shown in figure

The code generated will some times canbe used as it is. or will do 70% of the work.  if is possible to call a macro from Emacs. most of the work is done.

The code generated will be use full not only in magik but also while dong Ole_program from java, phyton. etc..