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 rigname in a format that should never change. Here is an example of the code that I will be working with.
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 cursor up a couple 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.
Code:
<TD><IMG border=0 alt="Daily Report" src="images/daily_report.png" width=16 height=16> <A href="GenericTxDReport.aspx?PageMode=Daily&ScenarioId=55&UtcTimeRange=1332133200000-1332219600000"><SMALL>Daily Report</SMALL></A> </TD>
<TD><IMG border=0 alt=Archive src="images/archive.png" width=16 height=16> <A href="Archive.aspx?RigName=Top+Secret&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&ScenarioId=55&UtcTimeRange=1332133200000-1332219600000
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&ScenarioId
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.