Đang chuẩn bị liên kết để tải về tài liệu:
Office VBA Macros You Can Use Today phần 7

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Để xem được vĩ mô, mở các mô-đun Macros mới trong dự án vĩ mô đã được tạo ra. Xem Phụ lục ban hành kèm để tìm hiểu làm thế nào để mở VBE và xác định vị trí các mô-đun NewMacros. | Word Procedures Wrd End Sub End Sub End Variable declarationfl Dim frm As frmUserInputfl Dim doc As Word.Documentfl Set doc ActiveDocumentfl If doc.Bookmarks.Count 1 Thenfl MsgBox Invalide document. _fl No bookmarks could be found. _fl vbCritical vbOKOnlyfl Exit Subfl End Iffl Set frm New frmUserInputfl GetDataFromDocument frm docfl frm.Showfl If frm.Tag OK Thenfl PutDataIntoDocument frm docfl End Iffl Unload frmfl If doc.Bookmarks.Exists txtStartBody Thenfl doc.Bookmarks txtStartBody .Range.Selectfl End Iffl Subfl fl GetDataFromDocument frm As UserForm doc As Word.Document fl Variable declarationfl Dim ctl As MSForms.Controlfl Dim firstControl As Booleanfl For Each ctl In frm.Controlsfl If doc.Bookmarks.Exists ctl.Name Thenfl ctl.Text doc.Bookmarks ctl.Name .Range.Textfl If Not firstControl Thenfl ctl.SelStart 0fl ctl.SelLength Len ctl.Text fl firstControl Truefl Iffl End End Iffl Nextfl Subfl fl PutDataIntoDocument frm As UserForm doc As Word.Document fl Variable declarationfl Dim ctl As MSForms.Controlfl Dim rng As Word.Rangefl For Each ctl In frm.Controlsfl If doc.Bookmarks.Exists ctl.Name Thenfl Set rng doc.Bookmarks ctl.Name .Rangefl rng.Text ctl.Textfl doc.Bookmarks.Add Name ctl.Name Range rngfl Iffl End Nextfl Subfl page 256 Office VBA Macros You Can Use Today Word Procedures Follow these steps 1. Copy the macro code to the correspondence template s VBA project. 2. Transfer the UserForm frmUserInput to the same project using either the Organizer or by dragging it in the Visual Basic Editor VBE to the template s project. The code for this UserForm module is below for reference. View the Appendix to learn how to store this procedure in a UserForm. Option explicitfl fl Private Sub btnCancel_Click fl Me.Hidefl Me.Tag Cancel fl End Subfl fl Private Sub btnOK_Click fl Me.Hidefl Me.Tag OK fl End Subfl The code in the example file also includes the basCreateBookmark module which is utilized in the Creating a Bookmark from a Selection entry found on page 260. It is

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.