Cannot Run Macro Error Trying To Open Userform In A Second Book

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have run into a pretty significant loss and after an exhaustive Google sesrch I wasn't able to find a solution to address my issue.

I have a userform for in workbook1. A click on one of it's objects is to facilitate the launching of a second userform in a second workbook (wb_rd). This second workbook (wb_rd) had been previously opened by by code in workbook1, so it is open, but hidden.

I've just started to receive the error again. My code started fine and not encountering the error. After some more developement I started to get this error. But, without reverting back any changes, the error disappeared. But now it has reappeared again. Not only do I know how to avoid it, I have no idea what it takes to cause it. It is an unreliable point in my code and I really should identify the cause and prevent it from happening once it gets released to users.

From workbook1, the object click code: "Cannot run the macro 'Rental_Detail.xlsm!macro_01'. The macro may not be available in this workbook or all macros may be disabled."

Rich (BB code):
Private Sub lb_cntmissp_Click()
    If lb_cntmissp.Caption = "0" Then Exit Sub
    With wb_rd
        Application.Run wb_rd.Name & "!macro_01"
    End With
End Sub

wb_rd, again, is a recognized workbook (workbook2) and !macro1 resides in a standard module within that workbook. The line in red is where the error happens.

Rich (BB code):
Sub macro_01()
    mri = 1 'true
    MsgBox "MRI: " & mri
    declarations_1
    'group_1.Show
End Sub

When I first experienced this problem I posted here looking for a solution. Although someone was kind enough to share a possible solution, I have to admit it is far beyond the scope of my knowledge to adpat. I hope there is an easier solution.
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top