View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TBarreiro TBarreiro is offline
external usenet poster
 
Posts: 3
Default Running a macro in a open as read-o Workbook


I have this macro NOT running OK when I open the BCENTRAL.XLS as a read
only.

Can anyone help point out what I am missing here ?



sub ....()

On Error Resume Next
lhn = Target.Row
wb_name = ThisWorkbook.Name
wsh_name = ThisWorkbook.ActiveSheet.Name
On Error Resume Next

Application.Run "BCentral.xls!PM_show_form2", lhn, wb_name, wsh_name

' it should have run here, but in a read only, it doesnt...

' the rest of the code I use when I'm runnig more Excel instances...

xx = Error.Number
If xx < 0 Then
Else
Set MyXL = GetObject(, "Excel.Application")
If Err.Number < 0 Then ExcelWasNotRunning = True
Err.Clear ' Clear Err object in case error occurred.
DetectExcel
Set MyXLx = GetObject("\\...\BCENTRAL.XLS")
If IsEmpty(MyXLx) = False Then
Set wk = MyXL.Worksheets("MAIN")
MyXL.Run "BCentral.xls!PM_show_form2", lhn, wb_name, wsh_name,
MyXL
Else
Err.Clear
MsgBox ("BCENTRAL is missing")
UserForm1.Show
End If
End If