ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   url not accessible (https://www.excelbanter.com/excel-programming/384329-url-not-accessible.html)

mikeolson

url not accessible
 
I have a macro that imports a text file from a website, it works fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on the above
location. If I change the location, now my macro has the wrong url in the
code. When I use the http//www.mywebsitename.com/file.txt it does not access
the file, change to the other address it works fine. Why won't it work? If
I type both addresses in my web browser, I get the same result, why not in
the macro code?

Thank you for your help!
Mike

NickHK

url not accessible
 
Mike,
I'm no web expert, but server behave differently as to what/how they expect
the sent data to be.
Other difference regarding username/password, cookies etc may be involved.
A full-blown browser may well be handling these aspects for you, under the
hood, in a way that Excel cannot, or is not yet set to do so.

NickHK

"mikeolson" wrote in message
...
I have a macro that imports a text file from a website, it works fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on the above
location. If I change the location, now my macro has the wrong url in the
code. When I use the http//www.mywebsitename.com/file.txt it does not

access
the file, change to the other address it works fine. Why won't it work?

If
I type both addresses in my web browser, I get the same result, why not in
the macro code?

Thank you for your help!
Mike




Don Guillett

url not accessible
 
Hard to tell without testing the actual but
Have you tried it with just the website?

--
Don Guillett
SalesAid Software

"mikeolson" wrote in message
...
I have a macro that imports a text file from a website, it works fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on the above
location. If I change the location, now my macro has the wrong url in the
code. When I use the http//www.mywebsitename.com/file.txt it does not
access
the file, change to the other address it works fine. Why won't it work?
If
I type both addresses in my web browser, I get the same result, why not in
the macro code?

Thank you for your help!
Mike




mikeolson

url not accessible
 
I have tried it with just the website. Here are the to actual websites
involved:
the file I am after for the update is:
http//home.wi.rr.com/theolsons4/update.txt
http//www.dealerfinancesolutions.com/update.txt
the home.wi works great in the code, the other does not

Thanks!

Mike

"Don Guillett" wrote:

Hard to tell without testing the actual but
Have you tried it with just the website?

--
Don Guillett
SalesAid Software

"mikeolson" wrote in message
...
I have a macro that imports a text file from a website, it works fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on the above
location. If I change the location, now my macro has the wrong url in the
code. When I use the http//www.mywebsitename.com/file.txt it does not
access
the file, change to the other address it works fine. Why won't it work?
If
I type both addresses in my web browser, I get the same result, why not in
the macro code?

Thank you for your help!
Mike





NickHK

url not accessible
 
Mike,
If I first go to "http//www.dealerfinancesolutions.com", I get a "site under
construction. Then add the "update.txt" to the URL, I get the text file.
So, maybe something in the way the site is set up ?

NickHK

"mikeolson" wrote in message
...
I have tried it with just the website. Here are the to actual websites
involved:
the file I am after for the update is:
http//home.wi.rr.com/theolsons4/update.txt
http//www.dealerfinancesolutions.com/update.txt
the home.wi works great in the code, the other does not

Thanks!

Mike

"Don Guillett" wrote:

Hard to tell without testing the actual but
Have you tried it with just the website?

--
Don Guillett
SalesAid Software

"mikeolson" wrote in message
...
I have a macro that imports a text file from a website, it works fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on the

above
location. If I change the location, now my macro has the wrong url in

the
code. When I use the http//www.mywebsitename.com/file.txt it does not
access
the file, change to the other address it works fine. Why won't it

work?
If
I type both addresses in my web browser, I get the same result, why

not in
the macro code?

Thank you for your help!
Mike







mikeolson

url not accessible
 
the "site under construction" is a pubished blank page, when the update.txt
is added it works fine if I use the home.wi.rr.com/theolsons4/update.txt but
not when www.dealerfinancesolutions.com/update.txt is used in my macro. Any
suggestions?

Mike

"NickHK" wrote:

Mike,
If I first go to "http//www.dealerfinancesolutions.com", I get a "site under
construction. Then add the "update.txt" to the URL, I get the text file.
So, maybe something in the way the site is set up ?

NickHK

"mikeolson" wrote in message
...
I have tried it with just the website. Here are the to actual websites
involved:
the file I am after for the update is:
http//home.wi.rr.com/theolsons4/update.txt
http//www.dealerfinancesolutions.com/update.txt
the home.wi works great in the code, the other does not

Thanks!

Mike

"Don Guillett" wrote:

Hard to tell without testing the actual but
Have you tried it with just the website?

--
Don Guillett
SalesAid Software

"mikeolson" wrote in message
...
I have a macro that imports a text file from a website, it works fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on the

above
location. If I change the location, now my macro has the wrong url in

the
code. When I use the http//www.mywebsitename.com/file.txt it does not
access
the file, change to the other address it works fine. Why won't it

work?
If
I type both addresses in my web browser, I get the same result, why

not in
the macro code?

Thank you for your help!
Mike







NickHK

url not accessible
 
Mike,
If you record a macro whilst do a web query to
www.dealerfinancesolutions.com/update.txt, you will see that the actual URL
recorded points to home.wi.rr.com/theolsons4/update.txt.
As such, it seems that Excel cannot use your desired URL, possibly due to
redirection and/or the way the site is set up. But that's conjecture on my
part.

If you force a web query with www.dealerfinancesolutions.com/update.txt, I
get this text string returned:
"dealerfinancesolutions.com;http://home.wi.rr.com/theolsons4/;//update.txt"

I suppose you could parse that string, extract the "real" URL and use that
in a secondary web query.
Or set a reference to "Microsoft WinHTTP Services" and get the real URL
yourself:

Dim WithEvents HTTPStuff As WinHttpRequest

Private Sub CommandButton1_Click()

Set HTTPStuff = New WinHttpRequest

With HTTPStuff
.Open "GET", "http://www.dealerfinancesolutions.com/update.txt"
.Send
End With
End Sub

Private Sub HTTPStuff_OnResponseFinished()
MsgBox HTTPStuff.ResponseText
End Sub

Or maybe other components over which you have more control. e.g. Automating
IE

By the way, it looks like you txt file has a lot of extraneous Tab after the
data.

NickHK

"mikeolson" wrote in message
...
the "site under construction" is a pubished blank page, when the

update.txt
is added it works fine if I use the home.wi.rr.com/theolsons4/update.txt

but
not when www.dealerfinancesolutions.com/update.txt is used in my macro.

Any
suggestions?

Mike

"NickHK" wrote:

Mike,
If I first go to "http//www.dealerfinancesolutions.com", I get a "site

under
construction. Then add the "update.txt" to the URL, I get the text file.
So, maybe something in the way the site is set up ?

NickHK

"mikeolson" wrote in message
...
I have tried it with just the website. Here are the to actual

websites
involved:
the file I am after for the update is:
http//home.wi.rr.com/theolsons4/update.txt
http//www.dealerfinancesolutions.com/update.txt
the home.wi works great in the code, the other does not

Thanks!

Mike

"Don Guillett" wrote:

Hard to tell without testing the actual but
Have you tried it with just the website?

--
Don Guillett
SalesAid Software

"mikeolson" wrote in message
...
I have a macro that imports a text file from a website, it works

fine.
However, the macro contains the website where it is being hosted:
http//home.wi.rr.com/myusername/file.txt
My website: http//www.mywebsitename.com is currently hosted on

the
above
location. If I change the location, now my macro has the wrong

url in
the
code. When I use the http//www.mywebsitename.com/file.txt it does

not
access
the file, change to the other address it works fine. Why won't it

work?
If
I type both addresses in my web browser, I get the same result,

why
not in
the macro code?

Thank you for your help!
Mike










All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com