I was given this macro from this group

S

Steved

Hello from Steved

The below macro Keeps highlighting the belowand will not
work please help.

pWords = Split(Range.Text, " ")


Sub Testing()
Dim pWords() As String
pWords = Split(Range.Text, " ")
For i = 0 To UBound(pWords)
If pWords(i) Like "[a-zA-Z]{1,}" Then
pStartWord = i
Exit For
End If
Next

Output = pWords(pStartWord)
For i = pStartWord + 1 To UBound(pWords)
Output = Output & " " & pWords(i)
Next
End Sub
 
J

Jezebel

By now you should have learned enough about coding to actually read and
think about these code snippets. You can't just paste them into a module and
pray.

a) Insert, in place of Range.Text, whatever string you're working with.

b) Declare all the variables.
 
S

Steved

Hello from Steved

I am very new at this and have no idea about the
terminology and subsequently i've now have no idea
what to do with your kind answer. Please understand
the reason I came to this sight is to get an answerto my
issue, and the end result would be that it works. You are
asking me to understand code which is new to me so please
if you would bare with me please just show me how I can
get your macro to function. In other words a) and b)I
cannot comprehend.

Thankyou.

-----Original Message-----
By now you should have learned enough about coding to actually read and
think about these code snippets. You can't just paste them into a module and
pray.

a) Insert, in place of Range.Text, whatever string you're working with.

b) Declare all the variables.





Hello from Steved

The below macro Keeps highlighting the belowand will not
work please help.

pWords = Split(Range.Text, " ")


Sub Testing()
Dim pWords() As String
pWords = Split(Range.Text, " ")
For i = 0 To UBound(pWords)
If pWords(i) Like "[a-zA-Z]{1,}" Then
pStartWord = i
Exit For
End If
Next

Output = pWords(pStartWord)
For i = pStartWord + 1 To UBound(pWords)
Output = Output & " " & pWords(i)
Next
End Sub


.
 
J

Jezebel

The code is working on a piece of text. I don't know where the text is
coming from, so you'll need to put that in yourself. Presumably it's the
text of a paragraph ... but you can't expect the forum to write your entire
app for you. This is basic stuff well covered in help.

You declare variables with Dim statements. This too is very basic and well
explained in help as well as at the beginning of chapter 1 of any
programming guide you care to look at.

Trying to learn to program by trial and error is truly the slowest possible
way to go about it.





Steved said:
Hello from Steved

I am very new at this and have no idea about the
terminology and subsequently i've now have no idea
what to do with your kind answer. Please understand
the reason I came to this sight is to get an answerto my
issue, and the end result would be that it works. You are
asking me to understand code which is new to me so please
if you would bare with me please just show me how I can
get your macro to function. In other words a) and b)I
cannot comprehend.

Thankyou.

-----Original Message-----
By now you should have learned enough about coding to actually read and
think about these code snippets. You can't just paste them into a module and
pray.

a) Insert, in place of Range.Text, whatever string you're working with.

b) Declare all the variables.





Hello from Steved

The below macro Keeps highlighting the belowand will not
work please help.

pWords = Split(Range.Text, " ")


Sub Testing()
Dim pWords() As String
pWords = Split(Range.Text, " ")
For i = 0 To UBound(pWords)
If pWords(i) Like "[a-zA-Z]{1,}" Then
pStartWord = i
Exit For
End If
Next

Output = pWords(pStartWord)
For i = pStartWord + 1 To UBound(pWords)
Output = Output & " " & pWords(i)
Next
End Sub


.
 
C

Chuck

Hi Steve

Please see my response in your other thread (Subject: A bit of A challenge
for me to do.). See this message:
http://communities2.microsoft.com/c...77dd1b-2af3-4417-8445-e4327414e1d2&sloc=en-us

As Jezebel said in her response in this thread, a lot of information has
been provided for you to work with in figuring out for yourself how to make
her suggestions work in your particular circumstances.

An alternative might be offer to hire a developer to provide you with custom
code.

Chuck
 
S

Steved

Thankyou both for your input to my issue.

This is a once only project hence because I wanted a
complete macro that I could use (not to understand the
mechanics of the macro) i've decided on another way to
acheive my objective.

Once again thankyou.


-----Original Message-----
Hi Steve

Please see my response in your other thread (Subject: A bit of A challenge
for me to do.). See this message:
http://communities2.microsoft.com/communities/newsgroups/ en-us/default.aspx?
dg=microsoft.public.word.vba.general&mid=a177dd1b-2af3-
4417-8445-e4327414e1d2&sloc=en-us

As Jezebel said in her response in this thread, a lot of information has
been provided for you to work with in figuring out for yourself how to make
her suggestions work in your particular circumstances.

An alternative might be offer to hire a developer to provide you with custom
code.

Chuck

Steved said:
Hello from Steved

The below macro Keeps highlighting the belowand will not
work please help.

pWords = Split(Range.Text, " ")


Sub Testing()
Dim pWords() As String
pWords = Split(Range.Text, " ")
For i = 0 To UBound(pWords)
If pWords(i) Like "[a-zA-Z]{1,}" Then
pStartWord = i
Exit For
End If
Next

Output = pWords(pStartWord)
For i = pStartWord + 1 To UBound(pWords)
Output = Output & " " & pWords(i)
Next
End Sub
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top