Hi
I am using Excel 2003. The worksheet with raw data (WSD) is automatically updating based on a query from Access.
With Skip's help I've been able to make a copy of my current workbook with the raw data being saved and several protected cells. The code is below:
Now I would like to ensure that the connection to Access is removed so that the copy doesn't try to query Access. I've asked this before but none of the suggestions worked.
All assistance greatly appreciated - thanks.
I am using Excel 2003. The worksheet with raw data (WSD) is automatically updating based on a query from Access.
With Skip's help I've been able to make a copy of my current workbook with the raw data being saved and several protected cells. The code is below:
Code:
'this keeps the copy from being displayed
Application.ScreenUpdating = False
Sheets(Array("WSA", "WSB", "WSC", "WSD", "WSE", "WSF")).Copy
Set NewWB = ActiveWorkbook
Application.DisplayAlerts = False
Application.CutCopyMode = False
with NewWB.Sheets("WSD")
'unlock ALL cells
With .Cells
.Locked = False
.FormulaHidden = False
end with
'lock these cells
with .Range("L4:M40")
.Locked = True
.FormulaHidden = False
end with
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
end with
NewWB.SaveCopyAs Filename:="E:\My Documents\MyWB_" & Format(Now(), "YYYYMMDD") & ".xls"
ActiveWindow.Close
Application.ScreenUpdating = True
Now I would like to ensure that the connection to Access is removed so that the copy doesn't try to query Access. I've asked this before but none of the suggestions worked.
All assistance greatly appreciated - thanks.