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
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