I have an xlam code that I wish to have a "desktop shortcut" to.
So I managed to find a code that could open a new workbook and some code that should run a VBA code but it does not work for me.
This is the code:
Option Explicit
On Error Resume Next
ExcelMacroExample
Sub ExcelMacroExample()
Dim objExcel
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWb = objExcel.Workbooks.Add ' it seems the code stops here, but I don't know for sure.
objExcel.open "C:\Users\a78208\AppData\Roaming\Microsoft\AddIns\Buffertplatser.xlam"
objExcel.Run "read_history"
objExcel.Run "'Buffertplatser.xlam'!Modul1.read_history"
Set xlApp = Nothing
End Sub
As you can see I try to run the read_history script and I have tried many things to make it run but I believe it doesn't run due to Excel opening without loading the xlam files.
Excel opens quicker than normal and the add-ins tab is missing:
vs:
The buttons in this menu is added in workbook_open of the xlam file, so it seems the xlam file is not loaded.
However when I look at the add-ins settings, Excel says it is "on".
So, short question. How can I run the xlam script read_history
in a new workbook, or run the script read_history_ext
in any (if applicable) workbook.
The second script opens a new workbook so it can run in any workbook.