Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
|
|||
|
|||
![]()
Tom,
Thanks for your reply on 8-Feb. Sorry to be so long in responding, I am invariably intterupt and deadline driven and the need for that read only export macro has only now risen above other priorities. I tried both your macros, there seemed to be a few typos that needed fixing (as below in renditions ExportReadOnly1 and ExportReadOnly2). Then I tried a couple more variations. All of them seem to falter for the following reasons : Examples quoted from ExportReadOnly2 Set bk = ActiveWorkbook() ' Debugger shows bk has no value For Each sh In bk.Worksheets ' Debugger shows sh has no value so .UsedRange.Formula = UsedRange.Value ' Macro aborts with "object not found" or something to that effect. It does this with both Excel versions I have access to : MS Excel 97 SR-2 MS-Excel 2000 9.0.2720 Regards, Fred 2006-02-23(Thu) Sub ExportReadOnly1() ' ' ExportReadOnly macro created by Fred on 2006-02-23(Thu) Dim bk As Workbook Workbooks("MasterEMSDB.xls").Sheets("ABS ").Copy Set bk = ActiveWorkbook ActiveSheet.UsedRange.Formula = ActiveSheet.UsedRange.Value ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Workbooks("MasterEMSDB.xls:1").Sheets("ABS Test Bench ").Copy Befo=bk.Sheets(1) ActiveSheet.UsedRange.Formula = ActiveSheet.UsedRange.Value ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End Sub Sub ExportReadOnly2() ' ' ExportReadOnly macro created by Fred on 2006-02-23(Thu) Dim bk As Workbook Workbooks("MasterEMSDB.xls").Worksheets(Array("ABS Test Bench ", "ABS")).Copy Set bk = ActiveWorkbook() For Each sh In bk.Worksheets With sh .UsedRange.Formula = UsedRange.Value .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End With Next End Sub Sub ExportReadOnly3() ' ' ExportReadOnly macro created by Fred on 2006-02-23(Thu) Workbooks("MasterEMSDB.xls").Worksheets(Array("ABS Test Bench ", "ABS")).Copy ActiveWorkbook.SaveAs FileName:="C:\makeReadOnly.Xls", FileFormat:=xlNormal _ , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False For Each wSheet In ActiveWorkbook.Worksheets With wSheet .UsedRange.Formula = UsedRange.Value .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End With Next wSheet End Sub Sub ExportReadOnly4() ' ' ExportReadOnly macro created by Fred on 2006-02-23(Thu) Dim wSheet As Worksheet Workbooks("MasterEMSDB.xls").Worksheets(Array("ABS Test Bench ", "ABS")).Copy ActiveWorkbook.SaveAs FileName:="C:\makeReadOnly.Xls", FileFormat:=xlNormal _ , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False For Each wSheet In Workbook.Worksheets With wSheet .UsedRange.Formula = UsedRange.Value .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End With Next wSheet End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Relative Ranges in excel macro | Excel Worksheet Functions | |||
passing arguments from an excel macro to a word macro | Excel Discussion (Misc queries) | |||
Excel macro that opens new MS Word file and pastes data as a pictu | Excel Worksheet Functions | |||
excel macro inconsistency | Excel Discussion (Misc queries) |