ngăn chặn các máy ghi vĩ mô bằng cách nhấn vào nút Stop trên thanh công cụ ghi âm Dừng, bằng cách nhấn vào nút REC trên thanh trạng thái, hoặc bằng cách sử dụng Tools | Macro | Dừng lệnh ghi. 7. Kiểm tra vĩ mô bằng cách lựa chọn một số đoạn văn | Word Procedures Wrd Sub fl InsertPictureWithCaption fl Variable declarationfl Dim FileTolnsert As Stringfl Dim rng As Dim frm As FileTolnsert GetFileNamefl The user cancelledfl If Len FileToInsert 0 Then Exit Subfl Set rng 1 .Rangefl When in a paragraph with textfl move to the top so that the framefl will be associated with this paragraphfl and insert an empty paragraphfl If Len 1 . 1 Thenfl wdCollapseStartfl vbCrfl End Iffl Put a frame around the paragraphfl Set frm rng fl format the framefl FormatFrame frmfl Insert a picture into itfl _fl FileName FileToInsert _fl LinkToFile LinkGraphic _fl SaveWithDocument SaveInDoc _fl Range rngfl If frm Is Nothing Thenfl AddaCaptionInaFrame rngfl Elsefl AddaCaptionInaFrame End Iffl Moves insertion point out of framefl Unit wdCharacter Count 1fl Subfl fl End Function GetFileName As Stringfl Variable declarationfl Dim dlg As Set dlg Dialogs wdDialogInsertPicture fl With dlgfl .Displayfl End Withfl GetFileName End Functionfl page 166 Office VBA Macros You Can Use Today Word Procedures End Sub f Function FormatFrame ByRef frm As f Set the bordersf Falsef If TrUe Thenf With .OutsideColorIndex wdBlackf .OutsideLineStyle wdLineStyleSinglef .OutsideLineWidth wdLineWidth050ptf End Withf End Iff Determine how the frame sizesf The frame can size a picture proportionally if an exact height OR width is set f and let the other dimension size automatically Use if the frame should be a certain heightf LimitPictureHeightf If LimitPictureHeight wdFrameAuto Thenf LimitPictureHeightf InchesToPoints 3 f End Iff Use if the frame should be a certain widthfl LimitPictureWidthf If LimitPictureWidth wdFrameAuto Thenf .