Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba

ResolvedVersion Standard

Matthew has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

VBA

I am trying to write a web query for a site that gives a unique SESSION ID every time it is accessed. This means the code is useless after the first session times out.

Is there any way to resolve this please?

RE: VBA

Hi Matthew.

I notice this post has been unanswered for quite a while, probably because we need a bit more detail.

What language is the web site using to produce its pages? (eg. php, asp etc.)

What are you getting returned, and why is the code useless? Do you mean because the URL you give the web query needs to change each time? Have you tried just leaving out the SESSION ID from the URL?

Also, if the URL normally requires a log-in (to get the web information) then this will also be a problem. You may need to speak to the web administrator who may be able to set up a unique page based on the time and date and password. You could use an MD5 string to achieve this.

eg. public page is accessible at all times, but requires the correct md5 string. MD5 string is made up of date+time (to a 10 minute window?) + password.

PHP code on web site: md5(date("Y-m-d H:i:s", strtotime("now()"))."agreedPassword";

VBA function: see http://di-mgt.com.au/src/basMD5.bas.html or http://excelsig.org/VBA/wwHash.htm for examples. Or see Dr Soong's post at http://www.tutorials.de/forum/visual-basic/275442-md5-per-vba.html (provides a text file of the function you can copy/paste).

Then use the md5 string in your URL of the web query.
eg. http://www.thedomain.com/dir/web-query-file.php?key=hrjwky67542uierh

Hope this helps.

Regards, Rich

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Edit and format multiple worksheets in one operation

To select two or more non-adjacent worksheets, click on the tab of each worksheet, while holding down the [CTRL] key.
To select two or more adjacent worksheets, click on the tab of the first worksheet and then on the tab of the last worksheet, while holding down the [SHIFT] key.
Enter or modify your data and apply the necessary formatting options to the sheet that's displayed

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.