How to get web data which can be opened from a specific website into a different tab in excel - vba

I wont to pull data from a webpage on the basis of a criteria's into excel however I am unable to do so.
Website from which I wont to pull data can be logged in only via another website and not by just url.
For E.g. My site name is Elsc and to login into it I have to via another site Gatekeeper and elsc cannot be logged into in any other way.
So is there a solution to get data from such website by Macro.
Thanks in advance :)

I don't think Excel will give you this kind of control (controlling one URL from another URL). I tried to do this a long time ago; it never worked right. Can you just login to that URL and then run a simple VBA script to download the data? Also, consider using a Power Query to do this for you.
http://chandoo.org/wp/2015/08/21/import-web-data-power-query/

Related

Downloading a CSV file, secured by authorization, with a click on a button

I'm trying to get Excel to download a CSV file, from a link that changes by the day, with a click on a button. The thing is, it's locked behind an agreement-number, ID and password.
I, however, got two API tokens:
TheAppSecretToken
TheAgreementGrantToken
The link is:
https://secure.e-conomic.com/secure/generelt/exportdata2.asp?mode=doexport&kartotek=5&fradato=01-01-2017&tildato=01-02-2018&vcseparator=%3B&vcQualifier=%22
If people have another way, than using a VBA-code, to download this file with a click on a button, don't hold back with the suggestion.
I appreciate any help I can get, thank you. :-)
EDIT: It's not a duplicate for another question, as this uses Tokens, and or 3 login informations.
EDIT2: nvm. that the link is changing from day-to-day, I figured out that I can just put the date as far out in the future, as I like.
Edit:
I assume that the login call needs to be an POST request, but this is only a guess as I can't test it with the information you have given
Just change the loginBody with the information you need or change it to the format that the URL needs (like JSON) and you can send as many information as need
If needed you can also set more headers for any other tokens you have
URL = "YOURURL"
loginBody = "username=username&password=password&token=token"
HttpObj.Open("POST", URL)
HttpObj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
HttpObj.Send(loginBody)
Old answer:
As I'm not allowed to comment it seems what you are trying to do is explained here:
How do i download a file using VBA (Without internet explorer)

how to invoke server to get data from spreadsheet

I'm using google spreadsheet api to visualize data for users and I want to get feedback if data is wrong. I found how to get data from server side to spreadsheet here
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get
but i can't find out how to request sending data from spreadsheet to server. what i thought is write down url in one cell. so if user click url then get data from user's spreadsheet.
Can you suggest me better idea?
thanks in advance.

Control IE as another user from Excel

My sccenario is as follows:
I have an excel workbook that does a lot of stuff, like create users and such.
A part of this "create user"-procedure is to edit some info on a website.
BUT this website needs to be launched as another user which has access to it.
I have no problem controlling IE if I launch it normally with the current user. But when I launch IE as another user, I cant take control of it from Excel.
I have done a lot of googling and tried a lot of stuff.
Fx. code from the following sources:
http://www.makeuseof.com/tag/using-vba-to-automate-internet-explorer-sessions-from-an-excel-spreadsheet/
http://www.excely.com/excel-vba/ie-automation.shtml
http://www.mvps.org/emorcillo/en/code/vb6/iedom.shtml
None of which has worked in my scenario.
I found a very good workaround here: https://superuser.com/a/49462
Basically I found out that it's possible to force a loginprompt on pages using Windows Authentication, and then log in as a different user.
That means that the IE process still runs as my user, thus making it possible to take control of the window from Excel.

Complete Online Form Query And Store Result In Microsoft Access

I hoping to develop a simple database to store the results of OFAC searches in an Access database. The steps that I'm hoping to achieve follow:
Enter company name in Access form
Execute query (via clicking a button or otherwise)
Goto OFAC website (OFAC Website)
Enter Company name in Name Field
Execute a search by clicking Search button or hitting return.
Receive the result set and Store in Access table
Questions:
Can I accomplish these steps with Access
Are you aware of any resources (articles, Access add-ins, VBA Scripts) that can help me achieve these objectives
Thanks for your help
Yes, it's possible. OFAC provides access to data using web service API, which can be called using VBA. I didn't use VBA for accessing OFAC, but used with other web services. Search string "ofac list api" gives a lot of links, for instance here you can find code example for VB6, it's similar to VBA, may be useful.

Pass a string to various websites

I have a product code which I need to enter into 6 different websites in order to pull different information from them about the product. Is there away to save this product code into some sort of variable and pass it into each websites input box and it return all the information from each one automatically? Really have no idea where to go/start with this so if anyone can brainstorm a few ideas to get me moving that would be great.
In order get what you are planning for:
You need a script which visits the specified web site,
then at the website, you can get the element by tag.
For instance in javascript,
var textBox = document.getElementByTag(Input);
This will give you a reference to text field to enter the text. It can be done as follows:
textBox.value = "any string";
Once you have done this, you will have to retrieve the results from the page, based on the website layout.
So if you can specify about your work in detail, you would get better response.
Assuming you're talking about using an ordinary GUI browser, the best you can do is copy it to your system clipboard, and paste it into each page on the browser.
If you're talking about a programmatic web-access like wget or curl, it depends on what language you are writing your script in.
you have to create the web request for each web site and find a way to parse the response which will be HTML
have a look at the HttpWebRequest you can find lots of example on internet that shows how you can create an HTTP POST to a website.
http://www.terminally-incoherent.com/blog/2008/05/05/send-a-https-post-request-with-c/