Noah
asked on
Error With Running A Userform in A Different Workbook
Greetings Experts,
I have two excel Macro enabled workbooks, however, I have a userform in one workbook called "PART 1 - REFRESH COPY & PASTE" and I need to run the userform in another workbook called "example".
PART-1---REFRESH-COPY---PASTE.xlsm
example.xlsm
I was provided this code previously:
However, I keep getting this error and I have already allowed the file path under trust center
I have two excel Macro enabled workbooks, however, I have a userform in one workbook called "PART 1 - REFRESH COPY & PASTE" and I need to run the userform in another workbook called "example".
PART-1---REFRESH-COPY---PASTE.xlsm
example.xlsm
I was provided this code previously:
Sub ShowForm()
Application.Run "'" & ThisWorkbook.Path & "\PART-1---REFRESH-COPY---PASTE.xlsm'!OpenForm"
End Sub
However, I keep getting this error and I have already allowed the file path under trust center
ASKER
I have already tried that as well
ASKER
That's why in the error picture, it shows that PART 1 - REFRESH COPY & PASTE macro cannot be run
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I still get the same error
ASKER
Is it possible to export(copy and paste) an entire userform from one workbook into another workbook?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is it possible to export(copy and paste) an entire userform from one workbook into another workbook?Yes. In Visual Basic, right-click on the userform file name and choose 'Export'. Then in the target workbook in Visual Basic go to the menu and select File->Import and find the exported file.
ASKER
Oh it works now! Thanks so much for your help:)))))
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And in the post where I mentioned bolded, make sure that there's a double quote and a single quote before the path, a single quote at the end of the path, and a single quote and an exclamation point before OpenForm.
You’re welcome and I’m glad I was able to help.
If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.
Marty - Microsoft MVP 2009 to 2017
Experts Exchange Most Valuable Expert (MVE) 2015, 2017
Experts Exchange Top Expert Visual Basic Classic 2012 to 2018
Experts Exchange Top Expert VBA 2018
Experts Exchange Distinguished Expert in Excel 2018
If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.
Marty - Microsoft MVP 2009 to 2017
Experts Exchange Most Valuable Expert (MVE) 2015, 2017
Experts Exchange Top Expert Visual Basic Classic 2012 to 2018
Experts Exchange Top Expert VBA 2018
Experts Exchange Distinguished Expert in Excel 2018
ASKER
Okay I have noted all of your advice! Thanks again :)
Application.Run "'" & ThisWorkbook.Path & "\PART 1 - REFRESH COPY & PASTE.xlsm'!OpenForm"
since the userform is in PART 1 - REFRESH COPY & PASTE.xlsm and not in PART-1---REFRESH-COPY---PA
try to name your files differently with proper meaning.