

Incomplete content controls can appear out of place if not down right odd in a printed document. Hide Empty Content Controls (Do not print Placeholder Text) 'Redefine the range to encompass the graphic.Ī "PictureBM", oRng Set oILS = (FileName:=strPath, LinkToFile:=False, _ 'Clear range to ensure bookmark range is empty of any previous content. Set oRng = ActiveDocument.Bookmarks(strBMName).Range

Sub InsertPictureInBookmarkRange(strBMName As String, strPath As String) InsertPictureInBookmarkRange "bmPicture", "C:\Demo Picture.jpg" 'directory and a bookmark named bmPicture in the activeDocument. 'Assumes you have a graphics file named "Demo Picture.jpg" saved in the C:\ root Text Valuesįor example, you might want to fill in a bookmark with the text value your document user provides in and input box: (the first part of the the ChrW(13) & ChrW(7) end of cell mark)ĭocument bookmarks are easy to create and provide a convenient range target when working with VBA. 'Expand the range to the paragraph mark _ 'Replace the end of cell marker with a null string.įcnGetCellText3 = Replace(, ChrW(13) & ChrW(7), vbNullString)įunction fcnGetCellText4(ByRef oRng As Word.Range) As Stringįunction fcnGetCellText5(ByRef oRng As Word.Range) As String MsgBox fcnGetCellText5(ActiveDocument.Tables(1).Cell(1, 1).Range)įunction fcnGetCellText1(ByRef oCell As Word.Cell) As StringįcnGetCellText1 = Left(, Len() - 2)įunction fcnGetCellText2(ByRef oCell As Word.Cell) As Stringįunction fcnGetCellText3(ByRef oCell As Word.Cell) As String MsgBox fcnGetCellText4(ActiveDocument.Tables(1).Cell(1, 1).Range) MsgBox fcnGetCellText3(ActiveDocument.Tables(1).Cell(1, 1)) MsgBox fcnGetCellText2(ActiveDocument.Tables(1).Cell(1, 1)) MsgBox fcnGetCellText1(ActiveDocument.Tables(1).Cell(1, 1)) 'Passing the cell object using its row and column index as the argument. 'This demo requires an active document containing at least one table.
