Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sep 11, 3:57*pm, Joel wrote:
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:paramete rs=false&RequestGUID=**GUIDHERE**&rc:toolbar=true" Thanks for your help! Steven Hi Joel: The code looks good for rendering it, my biggest challenge though is extracting the SessionID and RequestGUID from the page source. It appears in a segment "<iframe src=", followed by the url you dissected. Do you know how to call on the page source and look for that? Actually, if that can be extracted, then the entire URL could be, which would probably be more effective. Nearly there. Steven |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sep 11, 6:38*pm, wrote:
On Sep 11, 3:57*pm, Joel wrote: 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:paramete rs=false&RequestGUID=**GUIDHERE**&rc:toolbar=true" Thanks for your help! Steven Hi Joel: The code looks good for rendering it, my biggest challenge though is extracting the SessionID and RequestGUID from the page source. It appears in a segment "<iframe src=", followed by the url you dissected. Do you know how to call on the page source and look for that? Actually, if that can be extracted, then the entire URL could be, which would probably be more effective. Nearly there. Steven Wow, I don't think I could have been more unclear than these couple of posts. Let's try this again. 1. I have created a macro that navigates through an series of online forms that lead to a report I need to download 2. The generated report is contained in an iFrame and I cannot figure out how to send commands to the objects or fields within the iFrame 3. When I extract (manually) the iFrame page address from the page source and navigate to it, I can send commands to the page. I'm not sure what the best approach to this is, but I am imagining that I call on the page source with code, search for the "<iframe src="and extract the address from there. My question - how do I access the page source using code to get that address? Here's the example <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" Steven |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm can interpret your question too many ways.
1) Do you already have the string? MyString = <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" then you just need to remove the charaters before the equal sign and send a web request like this Request = mid(MyString,instr(MyString,"=")+1 'Note if the string contains the double quotes they also have to be removed Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True 'get web page IE.Navigate2 Request Do While IE.readyState < 4 DoEvents Loop 2) Or do you already have an Internet object and are try to find the tag item "iframe". Tags start with <iframe and end with /iframe or / . The tag name is not necesssary and the en d of the tag but is nicer to have to make the code more readible. set MyTag = IE.document.getelementsbytagname("iframe") this will get all the iframe items. You may have to look through each one to find the correct one. for each itm in Mytag if itm.ClassName = "xyz" then end if next itm 3) Another trick is search for id="abc" on the internet object Set PageNumber = IE.document.getElementById("abc") 4) When all fails RowCount = 1 for each itm in IE.Document.All Range("A" & RowCount) = itm.classname Range("B" & RowCount) = left(itm.innertext,256) 'this is very long an can cause memory errors Range("C" & RowCount) = itm.tagname RowCount = RowCount + 1 next itm " wrote: On Sep 11, 6:38 pm, wrote: On Sep 11, 3:57 pm, Joel wrote: 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:paramete rs=false&RequestGUID=**GUIDHERE**&rc:toolbar=true" Thanks for your help! Steven Hi Joel: The code looks good for rendering it, my biggest challenge though is extracting the SessionID and RequestGUID from the page source. It appears in a segment "<iframe src=", followed by the url you dissected. Do you know how to call on the page source and look for that? Actually, if that can be extracted, then the entire URL could be, which would probably be more effective. Nearly there. Steven Wow, I don't think I could have been more unclear than these couple of posts. Let's try this again. 1. I have created a macro that navigates through an series of online forms that lead to a report I need to download 2. The generated report is contained in an iFrame and I cannot figure out how to send commands to the objects or fields within the iFrame 3. When I extract (manually) the iFrame page address from the page source and navigate to it, I can send commands to the page. I'm not sure what the best approach to this is, but I am imagining that I call on the page source with code, search for the "<iframe src="and extract the address from there. My question - how do I access the page source using code to get that address? Here's the example <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" Steven |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joel:
Method 2 finds the IFRAME tag, but I still can't figure out how to grab the address. I've been digging through documentation online, but I don't know how to phrase my question correctly for this. The site I am navigating through is a database for our online donations. Currently I log in, run a report and request the report in Excel format. The fields and buttons I manipulate in order to export the data to Excel format are all contained in an iFrame and I can't access any of the objects. I am trying to open the iFrame address using code and the only place I can find it is in the page source. ViewSource That's the string I provided at the beginning. Once I've got that string, I want to extract the sessionID and GUID which I can use in another string to force the export to an Excel file. Does that help? Steven 2) Or do you already have an Internet object and are try to find the tag item "iframe". *Tags start with <iframeand end with * */iframe *or / . The tag name is not necesssary and the en d of the tag but is nicer to have to make the code more readible. set MyTag = IE.document.getelementsbytagname("iframe") this will get all theiframeitems. *You may have to look through each one to find the correct one. for each itm in Mytag * *if itm.ClassName = "xyz" then * *end if next itm |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I turn off page reference in page break preview | Excel Discussion (Misc queries) | |||
how can I amend my address data source | New Users to Excel | |||
Changing the Source Address of a Link | Excel Discussion (Misc queries) | |||
Problem with managing excel embedded with IFRAME | Excel Programming | |||
how to put a reference from a page of a multipage form to another page | Excel Programming |