View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
pkeegs pkeegs is offline
external usenet poster
 
Posts: 46
Default protect in macro

Thanks Leth,

I'll have to study what you are saying & check with Pearson - but it seems
to me that I am unprotecting before the refresh and protecting after the
refresh, but there must be more to this than I am seeing.

"Leith Ross" wrote:


Hello pkeegs,

Running the code manually removes the protection before the query is
run. If the query is running automatically, the protection will have to
removed before the refresh and applied after the refresh. The Query
object generates 2 events *BeforeRefresh* and *AfterRefresh*. To use the
events in VBA requires creating a custom Class with events. This is
quite involved technique and not practical to attempt to explain here.
Chip Pearson has a good write up on this 'Application Events'
(http://www.cpearson.com/excel/AppEvent.aspx)

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=48227