run macro from network xlam addin via vba

solidENM

Board Regular
Joined
Feb 23, 2017
Messages
93
I currently have an excel addin with a variety of macros that is used by many people. I am unable to post an update if a single person has excel open. I am looking to remove that main "reference" addin from all users, and replace with a new addin that uses vba to open and run a macro from the original "reference" addin. This concept would allow me to update the reference file at any point, since its technically never open or in use. The reference addin would only be "in use" for a split second during a macro run.

goal:
* addin to be used by others will run macro from reference addin
* reference addin would be my regular addin, which i could hopefully update at any point in time.

in the past i have made a virtualwb and ran macros on that. This is not working because i need to run the macro on the original sheet.



Sub GPI()
'
' polls server for GPImacro. This allows us to post updates at anytime. Does not matter if someone has excel/this macro open.

'
Application.ScreenUpdating = False

'designate current workbook before opening the macro workbook from server.
Dim OriginalWB As Worksheet
Set OriginalWB = ActiveSheet


' create virtual workbook from server file. will allow mult users access.
Dim strTemplate As String: strTemplate = "[full filename/path of excel]" ' Server copy
Dim VirtualWB As Workbook
Set VirtualWB = Workbooks.Add(strTemplate)
VirtualWB.Activate
ActiveWindow.WindowState = xlMinimized


' now open original workbook before running macro
OriginalWB.Activate


Application.ScreenUpdating = True

' run macro off server file ' none of the three below work. i am getting error saying workbook not found. i also added a 1 to the end of hte filename since my virtual workbook adds a 1 at the end.
Application.Run "GPI" ' main macro
'Application.Run "'[filename]'!GPI"
'Application.Run "[file location\excel file]!GPI"



VirtualWB.Close



End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
If you make a network add-in read-only, then users can never lock it. You just remove the read-only flag, update and then reset the flag and the users get the new version next time they start Excel.
 
Upvote 0
Solution
If you make a network add-in read-only, then users can never lock it. You just remove the read-only flag, update and then reset the flag and the users get the new version next time they start Excel.
WOW! looks like that works. Its hard to believe it would have been that simple. thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,461
Members
452,645
Latest member
Tante

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