need help to complete my export to csv using macro.

P

PJ-UK

Hi all, I been trying all sorts and nothing works what I am trying to do is
this to convert cut n paste from a website and convert the info to an CSV
file to be imported into a excel worksheet.

However upon from cut n paste from website into Word (via text file to strip
out images) the Word ends looking like this...

Weapons

Revolver
3 Attack 2 Defense
Owned: 1
Pair of Brass Knuckles
2 Attack 2 Defense
Owned: 37
Add to Wishlist Send Gift
Police Baton
23 Attack 22 Defense
Owned: 1
.22 Pistol
2 Attack 0 Defense
Owned: 463
Add to Wishlist Send Gift
Sub Machine Gun
24 Attack 22 Defense
Owned: 3

Using a series of replace macros I manage to get it ending up like this...

Weapons, , , ,
Revolver, 3 Attack 2 Defense, Owned: 1, Pair of Brass Knuckles, 2
Attack 2 Defense, Owned: 37, Add to Wishlist Send Gift, Police Baton, 23
Attack 22 Defense, Owned: 1, .22 Pistol, 2 Attack 0 Defense, Owned: 463,
Add to Wishlist Send Gift, Sub Machine Gun, 24 Attack 22 Defense, Owned:
3, Butterfly Knife, 2 Attack 1 Defense, Owned: 417, Add to Wishlist Send
Gift,

Just 1 more step to make it a full imprtable working date CSV is to place
all the info on it's own row, thus to give something like this...

Weapons, , , ,
Revolver, 3 Attack 2 Defense, Owned: 1,
Pair of Brass Knuckles, 2 Attack 2 Defense, Owned: 37,
Add to Wishlist Send Gift,
Police Baton, 23 Attack 22 Defense, Owned: 1,
..22 Pistol, 2 Attack 0 Defense, Owned: 463,
Add to Wishlist Send Gift,
Sub Machine Gun, 24 Attack 22 Defense, Owned: 3,
Butterfly Knife, 2 Attack 1 Defense, Owned: 417,
Add to Wishlist Send Gift,

I can easily strip out all reference to add to wishlist send gift lines once
it manage to get it looking like this, I am stumped at this final stage of
the macro, can anyone advise me or give me ideas to try? I tried wildcard
but problem is using wildcard dont actually repace the actual data but
instead gives what the replace box give for example Find box: Owned:*, and
then Replace box: Owned:*,^p would give Owned:*, and new line but does not
retain the amount I have owned...

Thanks everyone for your time, PJ
 
D

Doug Robbins - Word MVP

Do an search and replace for "Add to Wishlist Send Gift" and replace it with
^p^&^p

Do a wildcard search for "(Owned: [0-9]{1,})" and replace it with \1^p

See the article "Finding and replacing characters using wildcards†at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
P

PJ-UK

Doug,

Thank you soo much for that, made a slight adjustment to make it work but ti
works cheers for that.

Doug Robbins - Word MVP said:
Do an search and replace for "Add to Wishlist Send Gift" and replace it with
^p^&^p

Do a wildcard search for "(Owned: [0-9]{1,})" and replace it with \1^p

See the article "Finding and replacing characters using wildcards†at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

PJ-UK said:
Hi all, I been trying all sorts and nothing works what I am trying to do
is
this to convert cut n paste from a website and convert the info to an CSV
file to be imported into a excel worksheet.

However upon from cut n paste from website into Word (via text file to
strip
out images) the Word ends looking like this...

Weapons

Revolver
3 Attack 2 Defense
Owned: 1
Pair of Brass Knuckles
2 Attack 2 Defense
Owned: 37
Add to Wishlist Send Gift
Police Baton
23 Attack 22 Defense
Owned: 1
.22 Pistol
2 Attack 0 Defense
Owned: 463
Add to Wishlist Send Gift
Sub Machine Gun
24 Attack 22 Defense
Owned: 3

Using a series of replace macros I manage to get it ending up like this...

Weapons, , , ,
Revolver, 3 Attack 2 Defense, Owned: 1, Pair of Brass Knuckles, 2
Attack 2 Defense, Owned: 37, Add to Wishlist Send Gift, Police Baton, 23
Attack 22 Defense, Owned: 1, .22 Pistol, 2 Attack 0 Defense, Owned: 463,
Add to Wishlist Send Gift, Sub Machine Gun, 24 Attack 22 Defense, Owned:
3, Butterfly Knife, 2 Attack 1 Defense, Owned: 417, Add to Wishlist Send
Gift,

Just 1 more step to make it a full imprtable working date CSV is to place
all the info on it's own row, thus to give something like this...

Weapons, , , ,
Revolver, 3 Attack 2 Defense, Owned: 1,
Pair of Brass Knuckles, 2 Attack 2 Defense, Owned: 37,
Add to Wishlist Send Gift,
Police Baton, 23 Attack 22 Defense, Owned: 1,
.22 Pistol, 2 Attack 0 Defense, Owned: 463,
Add to Wishlist Send Gift,
Sub Machine Gun, 24 Attack 22 Defense, Owned: 3,
Butterfly Knife, 2 Attack 1 Defense, Owned: 417,
Add to Wishlist Send Gift,

I can easily strip out all reference to add to wishlist send gift lines
once
it manage to get it looking like this, I am stumped at this final stage of
the macro, can anyone advise me or give me ideas to try? I tried wildcard
but problem is using wildcard dont actually repace the actual data but
instead gives what the replace box give for example Find box: Owned:*, and
then Replace box: Owned:*,^p would give Owned:*, and new line but does not
retain the amount I have owned...

Thanks everyone for your time, PJ
 

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