Share via

MS WORD VBA CODE

Anonymous
2018-12-04T06:13:56+00:00

VBA Code in MS WORD to search and find multiple numbers/ values in a specific column of a Table in MS WORD version 2007.

I am a beginner and new to Word VBA. Please help me in simplifying my cumbersome daily routine work with VBA Code. Advance thanks to all.

Dear friends, I need a Word VBA code. On its execution it should perform following series of actions: 

1. first it shall display one 'Input box' and allow to enter some numbers or any number or all numbers between  '0 to 1500' and also it should permit me to enter House numbers in like this format 11-12-134 (eleven hyphen twelve hyphenone hundred thirty four- without any space between number and hyphen) or 22-32-249A or 1-2-123A/B/2C etc., or Plot(when any land is divided into small pieces and assigns a number it is called 'Plot number' in India) numbers like 101P or 334/P etc.(without any space neither side of forward slash) 

  1. After completion of entering all above said format likenumbers through INPUT BOX and on clicking 'OK' button on 'Input Box', the code shall start search and find said numbers in a specific Column, example column No. 2 or column 2 or Column name, of a Table in Ms Word.
  2. After finding some or any of those numbers, all those numbers shall be changed to Bold and Blue colour font.
  3. Only those rows where those numbers were found shall be retained and remaining rows shall be deleted in that Table.
Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2018-12-07T20:17:51+00:00

    I recommend that you take a look at the free add-in called AuthorTec Find and Highlight. You can do a web search on its name or use the hot link I've provided. The link will take you to a tutorial on the add-in and if you find it suitable you can download the add-in from the website. BTW - I am the author of the add-in.

    I made changes to the add-in so it would run in your Office 2007 environment. So, if you see on the website that it only runs with Office 2010 or higher, you can now ignore that.

    The add-in will allow you to create your own custom list(s) of words, phrases and find them in your currently open document. The value of it is not only allowing you to save your custom search lists for reuse in other documents, but it also searches for all of the items in your list so if you have multiple items to locate, you don't have to perform the searches one at a time.

    The located items are highlighted in selected colors that you get to choose and you can run the searches using different lists and choosing different highlight colors for each list. There is a control that allows you to quickly move forward or backward to all of the highlighted items.

    Based on what you described as needing to do, this add-in, which again it is free with no strings attached, should help you be more productive in the task you are trying to accomplish with these addresses.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-12-06T09:51:24+00:00

    This is a pretty big request you have made. I hope you know that this forum is not a programming service.

    What have you tried to do with VBA to automate some of this? Can you show us your code and what you are having trouble with?

    Sir I have been newly introduced to the Word VBA through the Book I have purchased by name Microsoft Word VBA Guidebook written by ***Allen L. Wyatt (Author).***Even now I don't know the basics of said program as I started working on this a few days ago. It happened to join at an Advocate as a part time worker due to severe economical problem and the nature of work constrained me to search for Word VBA Macro code to simplify the work which I have to attend regularly every day which is cumbersome. To search & find certain specific numbers between 0-1500 including number formats like 11-12-134 etc., manually is not so easy. Hence I thought for a Word VBA code to automate routine work as there was option built in tool in Ms Word. I came to know through my friends that there are excellent programmers in this Forum who can write I intended WORD VBA MACRO within 5 to 10 minutes which is equivalent to the time to write a suggestion showing alternative ways to a layman. Sir if you provide said macro code, it would be very useful now to finish accumulated work right now by automation through VBA Code. However it would be written by me if I undergo thorough training in Word VBA obviously it would take some time. until then mine entrusted work would be accumulated to the extent unmanageable point. Sir I will be ever grateful to you all if you help in this regard. Thank you sir.

    Was this answer helpful?

    0 comments No comments
  3. Charles Kenyon 167.7K Reputation points Volunteer Moderator
    2018-12-04T22:34:48+00:00

    A good place to start learning to use Word vba, in my opinion, is a paid online course offered by Grant Gamble on Udemy. It is a 13-hour video course.

    Microsoft Word vba - Grant Gamble - Udemy

    If you look for it to be on sale (often) the cost will be $10-$12 US.

    An excellent book, although dated, is Writing Word Macros: An Introduction to Programming Word using VBA: by Steven Roman, PhD

    Otherwise, a great resource is the MVP vba site:

    https://wordmvp.com/FAQs/MacrosVBA/index.htm

    As Rich pointed out, this is not a programming service. Many people here will help you learn but you need to make the effort.

    Often people here will help with a short piece of code that gets around some glitch in Word. That is not what you are asking for, though.

    Keep in mind that answers on this forum come primarily from your fellow users, as volunteers.

    Also, be sure that you are familiar with how Word works without any programming. Otherwise, you will end up trying to write inferior programs to handle something where Word already has a tool available for your use. That means a good understanding of Styles, of the distinctions between character and paragraph formatting, and the intricacies of sections, to start with. The ability to program in a different language is also a good start.

    Note, I am not a programmer. I am a lawyer who knows a fair amount about Word and dabbles with programming.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2018-12-04T19:12:15+00:00

    This is a pretty big request you have made. I hope you know that this forum is not a programming service.

    What have you tried to do with VBA to automate some of this? Can you show us your code and what you are having trouble with?

    Was this answer helpful?

    0 comments No comments