Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Words 2003 VB

  • Please log in to reply
No replies to this topic

#1 DefinitelyNoExpert


  • Members
  • 41 posts
  • Local time:04:44 AM

Posted 27 April 2012 - 04:17 AM


I hope I found the right place to post a question about creating a macro in Word.

What I want to know, is whether it is possible to create a macro which will delete all the characters between two specific words.
In short: I figured out how to find the words in the file by recording my actions when I used "ctrl+f". However, when I tried to record me deleting the characters inbetween, it turns out that I have to know how many characters there are to do that. In other words, the macro uses "Count". But I just want it to delete everything inbetween, no matter how many characters.

In long:

I’d like to list my bookmarks from firefox in a word (2003) document. The steps I’ve taken so far:

1) I saved all my bookmarks as a HTML-document
2) I opened the HTML-document and viewed the source code, which I copied and pasted in a word document

This gives me a long list with bookmarks like this:

<DT><A HREF=" ADD_DATE="133475149" LAST_MODIFIED="133471649" ICON_URI="http://s.ytimg.com/yt/vicon-refresh-vfldLzJxy.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAAAAAQCAYAAAAf8/9hAAABYklEQVQ4jcXTzUoCURjG8XdTnnN0Zs7Yh4JIVyAEXUm0DVp0AW26gILAFiWJFJrYwo9FErQxAoMsjJxoNhUDQbgecSPjJgYGnhaVTCO1aOMLv9Xz375EE797It7RwzUjKkxDF64RDeMvHT38/NnyMhERtXWevtPD+I+2ztPUksK80QX8bmMSdq2Ch6UUgptfSwqTmlL0r3QBv+uFOFzXxftggKf1NQT3b00p+tTQuHchBX5IxuE4DhzHwXA4xFupiMt4FMGuoXGPz2P9Ho9vBznxzspQHWNI+g0MY9utztitlrILKbGurrGQVWVeVWNw6+SmINlWbAsC2f7e9iYlcirDMGuqjKPSgrvn6gcfqXYDB4NA7sry9gUIRQD+6hTeJ8KKjcLKoffkcqxyqawHWEIbgEm5RSWPlQZ/iOniHhWYeWswswv+M2BEnoddRG2s0U0PdE/JCKiD2TAbGlHU6nxAAAAAElFTkSuQmCC">Robert Palmer - Johnny and Mary - YouTube</A>

Of course this isn’t what I was going for, as I want a list with the names of my bookmarks/url’s and the corresponding url’s. I can do this by just deleting all the unnecessary information, but this will take a lot of time. So I figured I should write a macro for it :D This is what I want it to do:

1) find “ at the end of the url the cursor is located
2) select everything between this “ and the following >
3) delete this whole selection (by pressing enter once)
4) find the following </A>
5) select everything between this </A> and the following HREF="
6) delete this whole selection (by pressing enter twice)
7) etc.

Sounds like a plan? I thought so, but I have problems with writing “select everthing between * and * ” into a macro.
If I record my own movements while doing this in a word document, I just get

Selection.MoveRight Unit:=wdCharacter, Count:=922, Extend:=wdExtend

It is the COUNT which is the problem, for this isn’t 922 for every url…

Has anybody got a clever idea for me? Basicaly, I wonder what the macro-language is for “select everything between * and * ” .

Edited by hamluis, 27 April 2012 - 11:44 AM.
Edited for readability, moved from Programming to Business Applications - Hamluis.

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users