Several tips for working with Word or Excel

Source: Internet
Author: User
Tags range

A lot of useless spaces and blank lines of Word documents obtained by copying and pasting network resources are very cumbersome to delete, if you create a Word2007 macro with related functionality, and then add a button to the toolbar, when we click this button in the toolbar, we do this by executing the Word macro You can implement one-click deletion of all spaces and blank lines in the Word2007 document. Related articles: How to quickly clear the blank line in Word2007 start word2007 (similar to other versions), then close the default open Word document, and then click the Tools-Macros-visual Basic Editor command to bring up the VisualBasic editor, and in the Visual Basic Editor window, right-click "Normal" and select Insert-Module command to insert a module. After inserting a module, enter the following code in the window that is automatically opened to the right of the Visual Basic Editor: Sub Kongge () Dim i as Paragraph, n as Long application.screenupdating = False For all I in Activedocument.paragraphs if Len (i.range) = 1 Then i.range.delete n = n + 1 end If Next application.screenup Dating = True Options.autoformatasyoutypedeleteautospaces = True Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting with Selection.Find. Text = "". Replacement.text = "". Exit the Visual Basic Editor after the Wrap = Wdfindcontinue End and Selection.Find.Execute Replace:=wdreplaceall ended Sub code is entered. The code you just entered is automatically saved. Right-click anywhere on the toolbar and choose Customize from the menu that appears. Opens the Customize window and switches to the command option, selecting the macro option below the Categories list box, where an option named "Normal. Module 1.KongGe" appears below the command list box. Select this option and hold down the left mouse button to drag it toAnywhere on the toolbar. The toolbar appears with a name of Normal. Module 1.KongGe "command button, right click the command button, there will be a right-click menu, in this right-click menu we mainly do the following: 1. Replace the contents of the text box after name with delete spaces and blank lines. 2. Execute the "Change Button image" command, and in the submenu that appears, select one or two of your favorite icons (such as Hearts icon). After you complete the two steps above, close the Customize window finally. Now that we've finished adding the "Remove spaces and Blank lines" button in the toolbar, to delete spaces and empty lines in a Word document at a later time, just open the Word document, click the Remove spaces and blank Lines button in the toolbar, and then wait a moment for the spaces and blank rows in the Word document to be deleted. Tip: When we save a Web page as a text file and copy all the contents of the text file into word2007 for editing, because of the complexity generated by the empty line (not necessarily the blank line generated under the carriage return), clicking the Delete space and blank line button may not remove all empty rows at once, Click this button again and you can delete it all. When you enter and apply this macro, please adjust your Word macro security settings.

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.