Hi
I need a code for a macro to select every 3rd word after selection.
7 3523 ADezii 8,834
Recognized Expert Expert @alphanj
Have no idea as to what you are requesting, kindly be more specific, and post concrete examples.
So you want something like this?
Input:
I am human I am human I am human
Output:
human human human
@colintis
@colintis
some thing like that, but without output,
I want macro to find 3rd word, change its format, go to next 3rd word change the format again until the end of the document.
Like this:
I am human I am human I am human NeoPa 32,569
Recognized Expert Moderator MVP
Is this a Microsoft Word related question by any chance? It doesn't help to leave out so much important information when posting a question (in a predominantly Access forum).
ADezii 8,834
Recognized Expert Expert @alphanj
Like NeoPa, I feel as though this may be a Word question. In any event, I wrote comparable code that will also work in Word. In this case each 3rd Word is formatted in Upper Case: - Dim strTestString As String
-
Dim varSplit As Variant
-
Dim intCounter As Integer
-
Dim strBuild As String
-
-
strTestString = "She sells sea shells at the sea shore on a windy day"
-
-
varSplit = Split(strTestString, " ")
-
-
For intCounter = LBound(varSplit) To UBound(varSplit)
-
If (intCounter + 1) Mod 3 = 0 Then
-
strBuild = strBuild & " " & UCase(varSplit(intCounter))
-
Else
-
strBuild = strBuild & " " & varSplit(intCounter)
-
End If
-
Next
-
-
Debug.Print Trim(strBuild)
OUTPUT: - She sells SEA shells at THE sea shore ON a windy DAY
NeoPa 32,569
Recognized Expert Moderator MVP
It's nevertheless an important question my friend, as Word has built-in objects and collections for things like words and paragraphs etc. It's not a good idea to reinvent the wheel. It introduces too many complications, and issues of compatibility etc. It's really down to the OP to make the question clear in the first place, or at least to respond intelligently to prompts.
To be clear, this is not a critique of your code in any way.
ADezii 8,834
Recognized Expert Expert @NeoPa
You are, of course, 100% correct. Just meant to be a Pointer in hopefully the right direction, since at least the Split() Function is supported in Word.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: simonmarkjones |
last post by:
Is there a simple way to capatalise the first letter of every word
typed into a textbox on a form. Someone told me to use "Proper" but not
sure if this is correct or how and where to use it.
Please can someone help.
Many thanks in advance!
|
by: Ricky Kam |
last post by:
I'm using MODI, after the document is OCR, is there a way to select a word in
a specific area? I know it can be done if someone use the mouse and do the
selection manually, but if I want to achieve the same thing with code, how do
I do it? Would someone should be a code sample please?
I'm using VB.net/VS.net
Thank you in advance
|
by: derelict |
last post by:
Hey all, im getting desperate now.
I have a macro running in Word 2003, when I run the macro it *should* put a 'bottom' cell border in each cell that has the style used - this included a border at the top of the table and one at the bottom, like a set of container border for a table with no border within it. i.e
table heading
_______________________________ << top border
text in the table spanning multiple rows and columns...
|
by: A1000ma |
last post by:
I am trying to develop a C# program to fill in the blanks in a Word Form. Everything works beautifully while the program is running.
I had to go in to fix some links on our Web Site a couple of days later and found any Word Document containing links now shows the code instead of the link. i.e. {HYPERLINK "Executive%20Summary%20for%20CSI.doc"} instead of CSI. I have traced this error down to my program but don't know what is causing it.
...
|
by: rando1000 |
last post by:
How do I select every other, or every third, record in a table, based on a numeric ID field? I haven't had to do this in a couple years, and I can't remember. I think it has to do with Mod?
| |
by: nkg6971 |
last post by:
Hi All,
Is there anyway to execute a excel macro from ms word macro? Code requested.
Thanks in advacne.
|
by: priby |
last post by:
Greetings to all,
I am new to VB. In my VBA macro I am trying to access a data source(a text file) using the below code snippet.
Dim TESTING As String
..
..
|
by: Vinodrajora |
last post by:
Hello Everyone
How are you?
Can we create a macro in the word or excel files to convert into the HTML format for the specific coding (for Paragraph, tables and bulleted items) in the HTML files.
Please explain from A to Z
Thanks and have a nice day
Vinod Kumar
|
by: alivip |
last post by:
I write code to get most frequent words in the file
I won't to implement bigram probability by modifying the code to do the following:
How can I get every Token (word) and PreviousToken(Previous word) and frequency and probability
From text file and put each one in cell in table
For example if the text file content is
"Every man has a price. Every woman has a price."
First Token(word) is "Every" PreviousToken(Previous...
|
by: wdangin |
last post by:
Please help if anyone knows how to select a word in textbox using Click Even which result the same as the default DoubleClick even in textbox or any control?
Thank you.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |