ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running a macro in a open as read-o Workbook (https://www.excelbanter.com/excel-programming/339054-running-macro-open-read-o-workbook.html)

TBarreiro

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



All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com