Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Refreshing Data In Excel / VBA

Hello,

I wonder if anyone can help me please ?
(I've tried using the search, but couldn't find what I was looking for)

I have a spreadsheet which pulls data from a database using get
external data.
In this spreadsheet I have a macro which on the press of a button,
refreshes this data.
(It does this for multiple sheets, as there is a lot of data in there)

It then does other bits and pieces like Saving it as a new name etc.
This all works fine.

However, on occassions it must be experiencing problem with 'Timeout'
as I get the message "General ODBC error"

This obviously prevents the rest of my code from working.

I really want to put something like a loop in there which will say
something like :

If the query refreshes, then continue onto the next one.
However, if the query doesn't refresh for whatever reason, do it again
until it does, then move onto the next one.

I assume this is possible, but I really don't know the syntax as I'm
very new to this.

Here is the relevant part of my code :


VBA:
Sheets("Dashboard").Select
Range("B5").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("B19").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("G5").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("G19").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
If anyone can help me I'd be most grateful.

Thanks.

J.

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
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM
Getting Excel Data from One Sheet to Another.... Robin Excel Discussion (Misc queries) 2 April 21st 05 01:15 PM
How can deleted data reappear in a refreshed pivot table in Excel excel_user123456 Excel Discussion (Misc queries) 3 February 23rd 05 08:34 PM
pasting excel data in a powerpoint slide James Excel Discussion (Misc queries) 4 January 28th 05 02:23 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM


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

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

About Us

"It's about Microsoft Excel"