Word VBA tips

Source: Internet
Author: User

Determine whether the text is selected: If selection. type = wdselectionip then msgbox "Nothing is selected"

Select cells in word: selection. selectcell

After moving to the selected content: selection. collapse direction: = wdcollapseend
Locate the last row in word: selection. endkey unit: = wdstory or sendkeys "^ {end }"
Move to the end of the document Ctrl + end Ctrl + home Ctrl + Pagedown Ctrl + Pageup
Move to the top of word: selection. homekey unit: = wdstory
Move to the end of word: selection. endkey unit: = wdstory

In the table: selection. Information (wdwithintable) = true

Determine whether it is the style of the system itself (the style created by yourself is false): style. builtin if the attribute value is true, the specified object is the built-in style of Word

Characters in the circle: {EQ/O/AC (●, 2)} 'insert domain shortcut key Ctrl + F9
Denominator: {EQ/F (a, B )}
Party A: {EQ/R (A, B )}

Partition page: {= {page} * 2-1} on the left {= {page} * 2}

Protect the header and footer from modification: insert the header and footer-insert the 'continuous subscriber '-protect the document (form protection, anyone)
Different headers and footers on the home page: page settings-layout-header and footer-different homepage options are also available

Set the total number of pages: The domain code of the total number of pages is: {numpages} pages in total, but if it is after the segmentation, the total number of pages in this section is {sectionpages}

Determine whether the object is available: isobjectvalid

The main template cannot contain a custom toolbar (an issue occurs in Office2000)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.