LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
 
Posts: n/a
Default Some problems with suggestions 1-2: Possible Macro Timing Overrun generates Excel Exception

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
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
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Relative Ranges in excel macro edself Excel Worksheet Functions 6 October 13th 05 02:02 PM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM
Excel macro that opens new MS Word file and pastes data as a pictu Rob Excel Worksheet Functions 0 July 6th 05 05:12 PM
excel macro inconsistency JM Excel Discussion (Misc queries) 2 December 9th 04 01:13 AM


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