Disable “Unable to open . Cannot locate the Internet server or proxy server” error












2















I've been having this problem in Excel 2003, but maybe it's also present in earlier versions.



I have an Excel spreadsheet that imports data using a web query, which connects to a web page hosted in my company's servers. The data changes day by day, and so does the URL, so I have a macro that takes care of the URL change and automatically refreshes all data every hour.



It works fine, but sometimes the company's server crashes. When my macro tries to connect to the server and it's down, the following message box appears: "Unable to open . Cannot locate the Internet server or proxy server". Excel stops the macro whenever this happens and it won't continue until I manually click on the Accept button. This is a big problem, since the data has to be constantly updated.



I've looked for many ways to solve the problem. I've tried adding an error handler, "Application.DisplayAlerts = False" at the top of the macro and I also did this, but to no avail.



Here's my code:



Sub ChangeURL()
Application.DisplayAlerts = False
On Error Resume Next
Dim NewURL As String
Dim Today As String
'M1 contains today's date formatted as text
Today = Range("M1").Value
NewURL = "URL;http://www.example-url.com/data/date=" & Today
'Change the table's URL so it gets today's data
With ActiveSheet.QueryTables(1)
.Connection = NewURL
End With
ActiveWorkbook.RefreshAll
'Re-execute the macro after an hour has passed
Application.OnTime Now + TimeValue("01:00:00"), "Change", , True
Application.DisplayAlerts = True
End Sub


Is there a way to truly disable these message boxes?










share|improve this question

























  • I'm not sure how you wrote the macro, but it sounds like a "try/catch" type situation. If it is written with VBA I think you need to add an "on error goto .......somewhere" clause...maybe pause it for a certain amount of time, or just exit. support.microsoft.com/en-us/kb/141571 stackoverflow.com/questions/6028288/…

    – Dean Spicer
    May 11 '15 at 5:04
















2















I've been having this problem in Excel 2003, but maybe it's also present in earlier versions.



I have an Excel spreadsheet that imports data using a web query, which connects to a web page hosted in my company's servers. The data changes day by day, and so does the URL, so I have a macro that takes care of the URL change and automatically refreshes all data every hour.



It works fine, but sometimes the company's server crashes. When my macro tries to connect to the server and it's down, the following message box appears: "Unable to open . Cannot locate the Internet server or proxy server". Excel stops the macro whenever this happens and it won't continue until I manually click on the Accept button. This is a big problem, since the data has to be constantly updated.



I've looked for many ways to solve the problem. I've tried adding an error handler, "Application.DisplayAlerts = False" at the top of the macro and I also did this, but to no avail.



Here's my code:



Sub ChangeURL()
Application.DisplayAlerts = False
On Error Resume Next
Dim NewURL As String
Dim Today As String
'M1 contains today's date formatted as text
Today = Range("M1").Value
NewURL = "URL;http://www.example-url.com/data/date=" & Today
'Change the table's URL so it gets today's data
With ActiveSheet.QueryTables(1)
.Connection = NewURL
End With
ActiveWorkbook.RefreshAll
'Re-execute the macro after an hour has passed
Application.OnTime Now + TimeValue("01:00:00"), "Change", , True
Application.DisplayAlerts = True
End Sub


Is there a way to truly disable these message boxes?










share|improve this question

























  • I'm not sure how you wrote the macro, but it sounds like a "try/catch" type situation. If it is written with VBA I think you need to add an "on error goto .......somewhere" clause...maybe pause it for a certain amount of time, or just exit. support.microsoft.com/en-us/kb/141571 stackoverflow.com/questions/6028288/…

    – Dean Spicer
    May 11 '15 at 5:04














2












2








2








I've been having this problem in Excel 2003, but maybe it's also present in earlier versions.



I have an Excel spreadsheet that imports data using a web query, which connects to a web page hosted in my company's servers. The data changes day by day, and so does the URL, so I have a macro that takes care of the URL change and automatically refreshes all data every hour.



It works fine, but sometimes the company's server crashes. When my macro tries to connect to the server and it's down, the following message box appears: "Unable to open . Cannot locate the Internet server or proxy server". Excel stops the macro whenever this happens and it won't continue until I manually click on the Accept button. This is a big problem, since the data has to be constantly updated.



I've looked for many ways to solve the problem. I've tried adding an error handler, "Application.DisplayAlerts = False" at the top of the macro and I also did this, but to no avail.



Here's my code:



Sub ChangeURL()
Application.DisplayAlerts = False
On Error Resume Next
Dim NewURL As String
Dim Today As String
'M1 contains today's date formatted as text
Today = Range("M1").Value
NewURL = "URL;http://www.example-url.com/data/date=" & Today
'Change the table's URL so it gets today's data
With ActiveSheet.QueryTables(1)
.Connection = NewURL
End With
ActiveWorkbook.RefreshAll
'Re-execute the macro after an hour has passed
Application.OnTime Now + TimeValue("01:00:00"), "Change", , True
Application.DisplayAlerts = True
End Sub


Is there a way to truly disable these message boxes?










share|improve this question
















I've been having this problem in Excel 2003, but maybe it's also present in earlier versions.



I have an Excel spreadsheet that imports data using a web query, which connects to a web page hosted in my company's servers. The data changes day by day, and so does the URL, so I have a macro that takes care of the URL change and automatically refreshes all data every hour.



It works fine, but sometimes the company's server crashes. When my macro tries to connect to the server and it's down, the following message box appears: "Unable to open . Cannot locate the Internet server or proxy server". Excel stops the macro whenever this happens and it won't continue until I manually click on the Accept button. This is a big problem, since the data has to be constantly updated.



I've looked for many ways to solve the problem. I've tried adding an error handler, "Application.DisplayAlerts = False" at the top of the macro and I also did this, but to no avail.



Here's my code:



Sub ChangeURL()
Application.DisplayAlerts = False
On Error Resume Next
Dim NewURL As String
Dim Today As String
'M1 contains today's date formatted as text
Today = Range("M1").Value
NewURL = "URL;http://www.example-url.com/data/date=" & Today
'Change the table's URL so it gets today's data
With ActiveSheet.QueryTables(1)
.Connection = NewURL
End With
ActiveWorkbook.RefreshAll
'Re-execute the macro after an hour has passed
Application.OnTime Now + TimeValue("01:00:00"), "Change", , True
Application.DisplayAlerts = True
End Sub


Is there a way to truly disable these message boxes?







microsoft-excel connection webserver runtime-error






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 12 '15 at 20:02







Moltrox

















asked May 11 '15 at 0:46









MoltroxMoltrox

1114




1114













  • I'm not sure how you wrote the macro, but it sounds like a "try/catch" type situation. If it is written with VBA I think you need to add an "on error goto .......somewhere" clause...maybe pause it for a certain amount of time, or just exit. support.microsoft.com/en-us/kb/141571 stackoverflow.com/questions/6028288/…

    – Dean Spicer
    May 11 '15 at 5:04



















  • I'm not sure how you wrote the macro, but it sounds like a "try/catch" type situation. If it is written with VBA I think you need to add an "on error goto .......somewhere" clause...maybe pause it for a certain amount of time, or just exit. support.microsoft.com/en-us/kb/141571 stackoverflow.com/questions/6028288/…

    – Dean Spicer
    May 11 '15 at 5:04

















I'm not sure how you wrote the macro, but it sounds like a "try/catch" type situation. If it is written with VBA I think you need to add an "on error goto .......somewhere" clause...maybe pause it for a certain amount of time, or just exit. support.microsoft.com/en-us/kb/141571 stackoverflow.com/questions/6028288/…

– Dean Spicer
May 11 '15 at 5:04





I'm not sure how you wrote the macro, but it sounds like a "try/catch" type situation. If it is written with VBA I think you need to add an "on error goto .......somewhere" clause...maybe pause it for a certain amount of time, or just exit. support.microsoft.com/en-us/kb/141571 stackoverflow.com/questions/6028288/…

– Dean Spicer
May 11 '15 at 5:04










1 Answer
1






active

oldest

votes


















0














Something like this might do the trick.



Sub MyMacro()

code...code...code
....trying to connect....
On Error GoTo ErrorHandler
code...code...code
Exit Sub

ErrorHandler:
. . .
Resume <or Exit Sub>
. . .

End Sub


FROM: https://support.microsoft.com/en-us/kb/141571






share|improve this answer
























  • I've tried to do this but to no avail. The error message still apears.

    – Moltrox
    May 12 '15 at 19:43











  • If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

    – Dean Spicer
    May 13 '15 at 0:43













  • The inability to connect must not be considered an "error"...hmmm.

    – Dean Spicer
    May 13 '15 at 0:44












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f913143%2fdisable-unable-to-open-url-cannot-locate-the-internet-server-or-proxy-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Something like this might do the trick.



Sub MyMacro()

code...code...code
....trying to connect....
On Error GoTo ErrorHandler
code...code...code
Exit Sub

ErrorHandler:
. . .
Resume <or Exit Sub>
. . .

End Sub


FROM: https://support.microsoft.com/en-us/kb/141571






share|improve this answer
























  • I've tried to do this but to no avail. The error message still apears.

    – Moltrox
    May 12 '15 at 19:43











  • If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

    – Dean Spicer
    May 13 '15 at 0:43













  • The inability to connect must not be considered an "error"...hmmm.

    – Dean Spicer
    May 13 '15 at 0:44
















0














Something like this might do the trick.



Sub MyMacro()

code...code...code
....trying to connect....
On Error GoTo ErrorHandler
code...code...code
Exit Sub

ErrorHandler:
. . .
Resume <or Exit Sub>
. . .

End Sub


FROM: https://support.microsoft.com/en-us/kb/141571






share|improve this answer
























  • I've tried to do this but to no avail. The error message still apears.

    – Moltrox
    May 12 '15 at 19:43











  • If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

    – Dean Spicer
    May 13 '15 at 0:43













  • The inability to connect must not be considered an "error"...hmmm.

    – Dean Spicer
    May 13 '15 at 0:44














0












0








0







Something like this might do the trick.



Sub MyMacro()

code...code...code
....trying to connect....
On Error GoTo ErrorHandler
code...code...code
Exit Sub

ErrorHandler:
. . .
Resume <or Exit Sub>
. . .

End Sub


FROM: https://support.microsoft.com/en-us/kb/141571






share|improve this answer













Something like this might do the trick.



Sub MyMacro()

code...code...code
....trying to connect....
On Error GoTo ErrorHandler
code...code...code
Exit Sub

ErrorHandler:
. . .
Resume <or Exit Sub>
. . .

End Sub


FROM: https://support.microsoft.com/en-us/kb/141571







share|improve this answer












share|improve this answer



share|improve this answer










answered May 11 '15 at 5:23









Dean SpicerDean Spicer

5661414




5661414













  • I've tried to do this but to no avail. The error message still apears.

    – Moltrox
    May 12 '15 at 19:43











  • If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

    – Dean Spicer
    May 13 '15 at 0:43













  • The inability to connect must not be considered an "error"...hmmm.

    – Dean Spicer
    May 13 '15 at 0:44



















  • I've tried to do this but to no avail. The error message still apears.

    – Moltrox
    May 12 '15 at 19:43











  • If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

    – Dean Spicer
    May 13 '15 at 0:43













  • The inability to connect must not be considered an "error"...hmmm.

    – Dean Spicer
    May 13 '15 at 0:44

















I've tried to do this but to no avail. The error message still apears.

– Moltrox
May 12 '15 at 19:43





I've tried to do this but to no avail. The error message still apears.

– Moltrox
May 12 '15 at 19:43













If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

– Dean Spicer
May 13 '15 at 0:43







If you copy the code for your macro (without the website if you like) we might be able to replicate the problem and give you a more specific answer. This sounds like a good challenge.

– Dean Spicer
May 13 '15 at 0:43















The inability to connect must not be considered an "error"...hmmm.

– Dean Spicer
May 13 '15 at 0:44





The inability to connect must not be considered an "error"...hmmm.

– Dean Spicer
May 13 '15 at 0:44


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f913143%2fdisable-unable-to-open-url-cannot-locate-the-internet-server-or-proxy-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?