View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Unprotect,refresh then protect again

from help on Refresh for a querytable:

expression.Refresh(BackgroundQuery)

expression Required. An expression that returns a PivotCache or QueryTable
object.

BackgroundQuery Optional Variant. Used only with query tables. True to
return control to the procedure as soon as a database connection is made and
the the query is submitted (the query is updated in the background). False
to return control to the procedure only after all data has been fetched to
the worksheet. If this argument isn't specified, the setting of the
BackgroundQuery property determines the query mode.


--
Regards,
Tom Ogilvy

"Deeds" wrote in message
...
Thanks. Can I get you to ellaborate. Where do I make this setting? All

I have now is code that "refreshes data".


----- Tom Ogilvy wrote: -----

you have to set the Backgroundquery property of the query to False so

the
code will wait for the refresh to complete.

--
Regards,
Tom Ogilvy

"Deeds" wrote in message
...
I am having a big problem trying to 1st. unprotect a sheet, in the

same
code run "refresh all", then protect the sheet again. I keep getting

an
error like it is trying to "refresh" after the sheet is protected
again...Can anyone explain how I unprotect, refresh then protect

again?
Thanks