Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Simple macro in Word for finding and copying some text.

Simple macro in Word for finding and copying some text.

Simple macro in Word for finding and copying some text.

I need to write a macro in Word to find and copy some text.  The text that I need to find is a URL in the source code from my company's website.  The problem is that the URL changes everyday because it includes a time range.  I found that in the source code, just two lines below the URL that I need, is the title of the webpage in a format that should never change.  Here is an example of the code that I will be working with.


<TD><IMG border=0 alt="Daily Report" src="images/daily_report.png" width=16 height=16>&nbsp;<A href="GenericTxDReport.aspx?PageMode=Daily&amp;ScenarioId=55&amp;UtcTimeRange=1332133200000-1332219600000"><SMALL>Daily Report</SMALL></A>&nbsp;&nbsp;</TD>

<TD><IMG border=0 alt=Archive src="images/archive.png" width=16 height=16>&nbsp;<A href="Archive.aspx?RigName=Top+Secret&amp;ScenarioIds = 55,53,41,37"><SMALL>Archive</SMALL></A></TD></TR>

This is what I need to extract from the above code.



Is there anyway to extract just that portion of the code flawlessly?  I would like to stick it into an excel cell, because I have an automation program that really works wonders with excel.

One catch is that the URL changes from day to day (like I said up top), and I need to identify the URL by using the rig name.  To kill two birds with one stone, I would like to search for this code:


and then, move the cursorup a coule of lines or something, and copy the URL.

I know this would be a peice of cake to someone out there, but I have struggled with it all day with no avail.  Thanks in advance.


RE: Simple macro in Word for finding and copying some text.

I'm not sure how to delete this post, but I started a new one in the correct forum. This one is obsolete now.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close