Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet protection order

I have a worksheet that I am launching from Access. I have code tha
tells Excel to Unprotect, then refresh, then protect again. It seem
thought that Excel tries to Protect the sheet before the refres
happens. Everytime that I try to run this, either from the Acces
code, or directly from the Excel workbook Open Event it fails, sayin
that it is protected. I need to be able to uprotect the workbook o
worksheets indivdually, refresh my database query, the reprotect i
all. Any ideas?? Here is what I have so far.
It works fine if I take out the Protect statements.

Thanks!


Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
oApp.Workbooks.Open FileName:="c:\SalesSystem\PAL Deal.xls"
'Only XL 97 supports UserControl Property

On Error Resume Next

oApp.UserControl = True

oApp.Worksheets("WAD").Unprotect
oApp.Worksheets("PO1").Unprotect
oApp.Worksheets("Data").Unprotect
oApp.ActiveWorkbook.RefreshAll
oApp.Worksheets("WAD").Protect
oApp.Worksheets("PO1").Protect
oApp.Worksheets("Data").Protect:confused

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Worksheet protection order

Change the properties of your queries to Backgroundquery = False

--
Regards,
Tom Ogilvy

"mtscooter " wrote in message
...
I have a worksheet that I am launching from Access. I have code that
tells Excel to Unprotect, then refresh, then protect again. It seems
thought that Excel tries to Protect the sheet before the refresh
happens. Everytime that I try to run this, either from the Access
code, or directly from the Excel workbook Open Event it fails, saying
that it is protected. I need to be able to uprotect the workbook or
worksheets indivdually, refresh my database query, the reprotect it
all. Any ideas?? Here is what I have so far.
It works fine if I take out the Protect statements.

Thanks!


Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
oApp.Workbooks.Open FileName:="c:\SalesSystem\PAL Deal.xls"
'Only XL 97 supports UserControl Property

On Error Resume Next

oApp.UserControl = True

oApp.Worksheets("WAD").Unprotect
oApp.Worksheets("PO1").Unprotect
oApp.Worksheets("Data").Unprotect
oApp.ActiveWorkbook.RefreshAll
oApp.Worksheets("WAD").Protect
oApp.Worksheets("PO1").Protect
oApp.Worksheets("Data").Protect


---
Message posted from http://www.ExcelForum.com/



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
Populate Order worksheet from Quote worksheet Veronica Johnson Excel Worksheet Functions 10 January 23rd 08 09:12 PM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Worksheet 1 exact copy of worksheet 2, but in different order Lou@CRA Excel Discussion (Misc queries) 1 July 11th 06 05:49 PM
Worksheet protection is gone and only wokbook protection can be se Eric C. Excel Discussion (Misc queries) 4 May 2nd 06 04:50 PM
Worksheet Protection stwky Excel Discussion (Misc queries) 3 April 12th 05 10:21 AM


All times are GMT +1. The time now is 03:53 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"