Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default HELP! Network Hung

I have a excel macro that continually gets data from the web. It will run
fine for a while and then the entire network connection from the PC hangs. I
can't access any network drives or the web. If I go into DOS and type
"netstat" all the connects are in "Close_Wait" state.

As soon as I close Excel the network works again.

The code I am using to get data from the web is :

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With



If anyone has any idea what could be happenign and how to fix this please,
please let me know.

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default HELP! Network Hung

Hi macroplay,

Are you repeatedly running the entire section of code you've shown? If
so you're creating lots and lost of query tables, which may be your problem.
You can create the query table once, give it a refresh interval and it will
automatically update itself without any problems. Here's an example based on
your code:

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.Refresh False
.RefreshPeriod = 60
End With

Just run this one time and it will create a query table that automatically
refreshes itself every 60 minutes (you can change the RefreshPeriod property
value to get a different refresh interval).

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
I have a excel macro that continually gets data from the web. It will run
fine for a while and then the entire network connection from the PC hangs.
I
can't access any network drives or the web. If I go into DOS and type
"netstat" all the connects are in "Close_Wait" state.

As soon as I close Excel the network works again.

The code I am using to get data from the web is :

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With



If anyone has any idea what could be happenign and how to fix this please,
please let me know.

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default HELP! Network Hung

Yes, I am running that code every 5 minutes.

Using the refresh feature would be problematic though because I have to
access a few different web sites and the URLs change every day because they
include a date string (I only posted one example of the web acces code).

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :

loop
set URL (which changes all the time)
get data into 1 and only temporary worksheet (temporary worksheet data is
cleared first)
parse data and copy into a permanent worksheet
end loop

"Rob Bovey" wrote:

Hi macroplay,

Are you repeatedly running the entire section of code you've shown? If
so you're creating lots and lost of query tables, which may be your problem.
You can create the query table once, give it a refresh interval and it will
automatically update itself without any problems. Here's an example based on
your code:

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.Refresh False
.RefreshPeriod = 60
End With

Just run this one time and it will create a query table that automatically
refreshes itself every 60 minutes (you can change the RefreshPeriod property
value to get a different refresh interval).

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
I have a excel macro that continually gets data from the web. It will run
fine for a while and then the entire network connection from the PC hangs.
I
can't access any network drives or the web. If I go into DOS and type
"netstat" all the connects are in "Close_Wait" state.

As soon as I close Excel the network works again.

The code I am using to get data from the web is :

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With



If anyone has any idea what could be happenign and how to fix this please,
please let me know.

thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default HELP! Network Hung

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :


A query table will accept a new connection string at any time. Assuming
you can automatically load your URL string variable with the correct URL
required for each refresh, you'd create the initial query table as before
but without setting the RefreshPeriod property, then use the following code
in a loop to update the query table with the new data from each new URL:

URL = "http://www.NextURL...."
With Sheet1.QueryTables(1)
.Connection = "URL;" & URL
.Refresh False
End With

There's no need to clear the previous data, the query table will replace its
previous data with the data from the new URL, even if the height and width
of the ranges are different.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
Yes, I am running that code every 5 minutes.

Using the refresh feature would be problematic though because I have to
access a few different web sites and the URLs change every day because
they
include a date string (I only posted one example of the web acces code).

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :

loop
set URL (which changes all the time)
get data into 1 and only temporary worksheet (temporary worksheet data
is
cleared first)
parse data and copy into a permanent worksheet
end loop

"Rob Bovey" wrote:

Hi macroplay,

Are you repeatedly running the entire section of code you've shown?
If
so you're creating lots and lost of query tables, which may be your
problem.
You can create the query table once, give it a refresh interval and it
will
automatically update itself without any problems. Here's an example based
on
your code:

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.Refresh False
.RefreshPeriod = 60
End With

Just run this one time and it will create a query table that
automatically
refreshes itself every 60 minutes (you can change the RefreshPeriod
property
value to get a different refresh interval).

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
I have a excel macro that continually gets data from the web. It will
run
fine for a while and then the entire network connection from the PC
hangs.
I
can't access any network drives or the web. If I go into DOS and type
"netstat" all the connects are in "Close_Wait" state.

As soon as I close Excel the network works again.

The code I am using to get data from the web is :

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With



If anyone has any idea what could be happenign and how to fix this
please,
please let me know.

thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default HELP! Network Hung

Sorry to ask another question...

In your example code

With Sheet1.QueryTables(1)

If I have done multiple QueryTables.Add on the same sheet how are they
numbered. Is the first qyuery 1 or 0 and do they just increment ?

thanks

"Rob Bovey" wrote:

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :


A query table will accept a new connection string at any time. Assuming
you can automatically load your URL string variable with the correct URL
required for each refresh, you'd create the initial query table as before
but without setting the RefreshPeriod property, then use the following code
in a loop to update the query table with the new data from each new URL:

URL = "http://www.NextURL...."
With Sheet1.QueryTables(1)
.Connection = "URL;" & URL
.Refresh False
End With

There's no need to clear the previous data, the query table will replace its
previous data with the data from the new URL, even if the height and width
of the ranges are different.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
Yes, I am running that code every 5 minutes.

Using the refresh feature would be problematic though because I have to
access a few different web sites and the URLs change every day because
they
include a date string (I only posted one example of the web acces code).

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :

loop
set URL (which changes all the time)
get data into 1 and only temporary worksheet (temporary worksheet data
is
cleared first)
parse data and copy into a permanent worksheet
end loop

"Rob Bovey" wrote:

Hi macroplay,

Are you repeatedly running the entire section of code you've shown?
If
so you're creating lots and lost of query tables, which may be your
problem.
You can create the query table once, give it a refresh interval and it
will
automatically update itself without any problems. Here's an example based
on
your code:

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.Refresh False
.RefreshPeriod = 60
End With

Just run this one time and it will create a query table that
automatically
refreshes itself every 60 minutes (you can change the RefreshPeriod
property
value to get a different refresh interval).

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
I have a excel macro that continually gets data from the web. It will
run
fine for a while and then the entire network connection from the PC
hangs.
I
can't access any network drives or the web. If I go into DOS and type
"netstat" all the connects are in "Close_Wait" state.

As soon as I close Excel the network works again.

The code I am using to get data from the web is :

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1, 1))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With



If anyone has any idea what could be happenign and how to fix this
please,
please let me know.

thanks









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default HELP! Network Hung

"macroplay" wrote in message
...
In your example code

With Sheet1.QueryTables(1)

If I have done multiple QueryTables.Add on the same sheet how are they
numbered. Is the first qyuery 1 or 0 and do they just increment ?


They're numbered in the order in which they were created beginning with
one. But in this situation you're probably safer giving them each explicit
names so you're sure you know which one you're operating on. Add the
following line of code to the procedure that creates the query table:

.Name = "Some_Unique_Name"

Then you can reference each query table by name, like so:

With Sheet1.QueryTables("Some_Unique_Name")

End With

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
Sorry to ask another question...

In your example code

With Sheet1.QueryTables(1)

If I have done multiple QueryTables.Add on the same sheet how are they
numbered. Is the first qyuery 1 or 0 and do they just increment ?

thanks

"Rob Bovey" wrote:

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :


A query table will accept a new connection string at any time.
Assuming
you can automatically load your URL string variable with the correct URL
required for each refresh, you'd create the initial query table as before
but without setting the RefreshPeriod property, then use the following
code
in a loop to update the query table with the new data from each new URL:

URL = "http://www.NextURL...."
With Sheet1.QueryTables(1)
.Connection = "URL;" & URL
.Refresh False
End With

There's no need to clear the previous data, the query table will replace
its
previous data with the data from the new URL, even if the height and
width
of the ranges are different.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"macroplay" wrote in message
...
Yes, I am running that code every 5 minutes.

Using the refresh feature would be problematic though because I have to
access a few different web sites and the URLs change every day because
they
include a date string (I only posted one example of the web acces
code).

Is there a way to bring web data into a worksheet without the refresh
feature like I am attempting to do now :

loop
set URL (which changes all the time)
get data into 1 and only temporary worksheet (temporary worksheet
data
is
cleared first)
parse data and copy into a permanent worksheet
end loop

"Rob Bovey" wrote:

Hi macroplay,

Are you repeatedly running the entire section of code you've
shown?
If
so you're creating lots and lost of query tables, which may be your
problem.
You can create the query table once, give it a refresh interval and it
will
automatically update itself without any problems. Here's an example
based
on
your code:

URL = "http://www.federalreserve.gov/releases/h10/Hist/dat00_ca.txt"
With ActiveWorkbook.Worksheets("Fx").QueryTables.Add( _
Connection:="URL;" & URL, Destination:=Worksheets("Fx").Cells(1,
1))
.BackgroundQuery = True
.Refresh False
.RefreshPeriod = 60
End With

Just run this one time and it will create a query table that
automatically
refreshes itself every 60 minutes (you can change the RefreshPeriod
property
value to get a different refresh interval).

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do you set up a network. Merlin Setting up and Configuration of Excel 0 August 15th 07 05:12 PM
Using an Add In on a Network Phin Doyle Excel Discussion (Misc queries) 5 January 12th 07 05:23 PM
Help - where to put VBCode on a network Mervyn Thomas Excel Programming 1 January 28th 04 11:31 AM
Any automation calls gets hung when the Excel workbook has an active cell. S.Tremblay Excel Programming 1 November 6th 03 05:43 PM
Copying files ...Network to Network Eric[_6_] Excel Programming 2 July 18th 03 08:59 PM


All times are GMT +1. The time now is 01:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"