
Characters(4).Font.Bold = msoTrue ' which is the W Note: I am trying to give the text specific formatting, like for example making the " NEW-TITLE" part of the text bold while keeping the remaining text as is.ĭoes this help: With. Why would we get " The specified value is out of range." error, whenever we try to access the myShape.TextFrame2 property, or even using Selection like below: myShape.Select IsFile = ((GetAttr(path) And vbDirectory) vbDirectory) ' Returns FALSE if not existing, or if it's a folder ' Returns TRUE if the provided name points to an existing file. Public Function IsFile(ByVal path As String) As Boolean , LinkToFile:=msoFalse, SaveWithDocument:=True) InlineShapes.AddPicture(FileName:=filePath _ ForeColor.ObjectThemeColor = msoThemeColorText2 , Selection.Information(wdVerticalPositionRelativeToPage) + 1 _

, Selection.Information(wdHorizontalPositionRelativeToPage) _ Set myShape = (msoTextOrientationHorizontal _ ' plus 1 down in vertical direction to prevent automatic moving to the previous paragraph during 'inlining' ' Place the text-box shape at the current cursor position Selection.MoveDown Unit:=wdParagraph, Count:=1 ' Set cursor position where we want the text-box If IsEmpty(filePath) Or Not IsFile(filePath) Then

Consider we create a text-box Shape with that contains an image Inline-Shape and store it into the myShape variable with VBA script, like below: Private Sub addImageButton_Click()ĭim doc As Document: Set doc = ThisDocument
