Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple macro in Word for finding and copying some text. 1

Status
Not open for further replies.

Xeeq

Technical User
Oct 12, 2011
27
0
0
US
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.

Code:
<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.
Code:
GenericTxDReport.aspx?PageMode=Daily&amp;ScenarioId=55&amp;UtcTimeRange=1332133200000-1332219600000

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:
Code:
RigName=Top+Secret&amp;ScenarioId
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.

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

Part and Inventory Search

Sponsor

Back
Top