cancel
Showing results for 
Search instead for 
Did you mean: 

Merging Table Cells In OLE MS WORD

Former Member
0 Kudos

hello experts

i really need your experts' advise on this.

currrently i am developing a program wherein the output should be written in MS Word. thus, i already used OLE to print the data to ms word.

however.. i am not been able to do one little thing on my program which is to merge a table cells.

here is the vb code i have obtained upon recording a macro for this process:

+Selection.TypeText Text:="a"+
    +Selection.MoveRight Unit:=wdCharacter, Count:=1+
    +Selection.TypeText Text:="b"+
    +Selection.MoveRight Unit:=wdCharacter, Count:=3+
    +Selection.TypeText Text:="1"+
    +Selection.MoveRight Unit:=wdCharacter, Count:=1+
    +Selection.TypeText Text:="2"+
    +Selection.MoveRight Unit:=wdCharacter, Count:=1+
    +Selection.MoveRight Unit:=wdCell+
    +Selection.TypeText Text:="a1"+
    +Selection.MoveRight Unit:=wdCharacter, Count:=1+
    +Selection.TypeText Text:="2b"+
    +Selection.MoveRight Unit:=wdCharacter, Count:=1+
    +Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend+
    +Selection.Cells.Merge+
    +Selection.InlineShapes.AddPicture FileName:="C:\Temp\00000016.jpeg.jpg", _+
        +LinkToFile:=False, SaveWithDocument:=True+
    +Selection.TypeParagraph+

here is the code that i have so far:

CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = 'a'.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = 'b'.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = ' '.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = '1'.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = '2'.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = ' '.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = '1a'.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = '2b'.
  CALL METHOD OF gv_wordobj 'NextCell'.
    CALL METHOD OF gv_wordobj 'Insert'
    EXPORTING #1 = ' '.
*_**it is working until here.._*
**
*_**here is the part that i dont know why its not working:_*
  call method of gv_wordobj 'moveup'
  exporting
    #1 = 'wdline'
    #2 = 2
    #3 = 'extend'.
  call method of gs_cell 'Merge'.


call method of gs_inlineshapes 'Addpicture'
	exporting
   #1 = 'C:\Temp\00000016.jpeg.jpg'
   #2 = 'false'
   #3 = 'True'
call method of gs_selection 'typepara'.

please let me know if you guys have any suggestions or any corrections on my OLE code. i will realy appreciate it.

by the way, no links please. i already exhausted and visited the links having "ms word OLE" keywords.

thanks a lot in advance again.

MrMagat

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

anyone?