Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
The Table insert and overall cell format works fine:
... wad = WDOC.activedocument wat = wad.Tables mytable = wat.add(:: Range=wadr, NumRows=1, NumColumns=4) ; Insert a 4 col table next Tabr = mytable.Range ; set range to last table Tabr.Style = "cfp Track bio" ; apply style to tableI can change the cell sizes:
C1 = myTable.Cell(1,1) ; Select row 1 col 1 C1.width = 72 ; Set width to 72 pts - 1" C1.Height = 80 ; Set height to 1.1"But I just can not figure out how to put a picture in C1. This is the vb Macro code that works:
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, numColumns:= 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= wdAutoFitContent Selection.InlineShapes.AddPicture FileName:= "C:\Aerostd\CFP\TrackPics\image005.jpg", LinkToFile:=False, SaveWithDocument:=TrueThis code puts a picture before the first paragraph of page 1.
iShapes = wad.InlineShapes cSel2 = iShapes.AddPicture (:: FileName= "C:\Aerostd\CFP\TrackPics\image002.jpg", LinkToFile=wdFalse, SaveWithDocument=wdTrue)> But the following code does NOT put the picture in cell 1:
Selection = C1.Select c1s = Selection.InLineShapes cls2 = c1s.AddPicture (:: FileName= "C:\Aerostd\CFP\TrackPics\image002.jpg", LinkToFile=wdFalse, SaveWithDocument=wdTrue)Cell 1 selects Ok. But I get "Not a valid OLE object" on c1s = Selection.InLineShapes
Any help would be enormously appreciated.I also need to put formatted paragraphs into cell 2?
; Winbatch 2003J, MS Word 2002 Pro... myGIF = "C:\Test\logo.gif" ;<-- change to your file... Word = ObjectOpen("Word.Application") Word.visible=@TRUE Docs = Word.Documents Docs.add ActiveDoc = Word.activedocument ADR = ActiveDoc.Range ;<-- create a RANGE reference... ADT = ActiveDoc.Tables mytable = ADT.add(:: Range=ADR, NumRows=1, NumColumns=4) ;<--- note changed RANGE reference... Tabr = mytable.Range ; set range to last table ;I can change the cell sizes: C1 = myTable.Cell(1,1) ; Select row 1 col 1 C1.width = 72 ; Set width to 72 pts - 1" C1.Height = 80 ; Set height to 1.1" ; Selection.InlineShapes.AddPicture FileName:="C:\Test\logo.gif", LinkToFile _ ; :=False, SaveWithDocument:=True CellRange = C1.Range ;<-- it needs a "range" object, so I just stuck .Range on the end !!! like line #11... CRIS = CellRange.InLineShapes CRIS.AddPicture(:: FileName = myGIF, LinkToFile = @FALSE, SaveWithDocument = @TRUE) Message("Word", "picture Insert into Cell is Complete") ; Clean up ObjectClose(CRIS) ObjectClose(CellRange) ObjectClose(C1) ObjectClose(Tabr) ObjectClose(mytable) ObjectClose(ADT) ObjectClose(ADR) ObjectClose(ActiveDoc) ObjectClose(Docs) ObjectClose(Word) Exit
Article ID: W16646
File Created: 2005:02:18:12:21:44
Last Updated: 2005:02:18:12:21:44