View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Get address from iFrame reference in page source

See if this helps


First example I boke you long string into several lines by using the & and
continuation character (_)

Sub Report()

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "https://reports.e2rm.com/ReportServer"
Request = "?/e2RM/Reports/CustomKFCDonation&" & _
"rs:Command=Render&" & _
"SessionID=**SESSIONIDHERE**&" & _
"rc:parameters=false&" & _
"RequestGUID=**GUIDHERE**&" & _
"rc:toolbar=true"

'get web page
IE.Navigate2 URL & Request
Do While IE.readyState < 4
DoEvents
Loop

end sub
---------------------------------------------------------------------------------------
Now I broke the command up to serveral variables

Sub Report()

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

CommandString = "rs:Command=Render&"
SessionString = "SessionID=**SESSIONIDHERE**&"
ParameterString = "rc:parameters=false&"
GuideString = "RequestGUID=**GUIDHERE**&"
ToolbarString = "rc:toolbar=true"

URL = "https://reports.e2rm.com/ReportServer"
Request = "?/e2RM/Reports/CustomKFCDonation&" & _
CommandString & _
SessionString & _
ParameterString & _
GuideString & _
ToolbarString

'get web page
IE.Navigate2 URL & Request
Do While IE.readyState < 4
DoEvents
Loop

end sub
---------------------------------------------------------------------------------------
Finally I made the SessionID a varialbe

Sub Report()

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

SessionID = "**SESSIONIDHERE**"

CommandString = "rs:Command=Render&"
SessionString = "SessionID=" & SessionID & "&"
ParameterString = "rc:parameters=false&"
GuideString = "RequestGUID=**GUIDHERE**&"
ToolbarString = "rc:toolbar=true"

URL = "https://reports.e2rm.com/ReportServer"
Request = "?/e2RM/Reports/CustomKFCDonation&" & _
CommandString & _
SessionString & _
ParameterString & _
GuideString & _
ToolbarString

'get web page
IE.Navigate2 URL & Request
Do While IE.readyState < 4
DoEvents
Loop

end sub

" wrote:

Hello!

I know this is not directly related to Excel programming, but I am
building a macro to download a report from our online tool into Excel.

The web address string is always the same except for the session ID
and the RequestGUID, but the address is the only place that I see it
referenced. Is there any way to extract that from the following
address into a macro variable?

<iframe src="https://reports.e2rm.com/ReportServer?/e2RM/Reports/
CustomKFCDonation&rs:Command=Render&SessionID=**SE SSIONIDHERE**&rc:parameters=false&RequestGUID=**GU IDHERE**&rc:toolbar=true"


Thanks for your help!



Steven