Excel Custom UI

TankPro

New member
Hi, I use a custom Excel.officeUI. But I’ve got an error message as following when clicking the ribbon menu in my EXE file.

“You cannot open two workbooks with the same name in Excel at the same time.”

Thanks.
 
No. my macro does not try to open the same workbook file.
I linked several macro which has following function.
  1. One of my macro is initializing the cell data with blank
  2. Save as dialogue box to save the cell data to the new worksheet
  3. Open dialogue box to read the cell values from the sheet and to write them to workbook
These macros are well working on original workbook, but all macro did not work in EXE file.

I tried to compile my workbook on the other computer, but I’ve got another error message when clicking the ribbon menu in my EXE file.
 
Hi,

i also have problems with my custom ui macros. with the compiled workbook the message box appears twice. this works in the normal Excel file.
Public ohneabbrechen As Boolean
Sub registrieren(control As IRibbonControl)
ohneabbrechen = True
Application.Quit
AppActivate ThisWorkbook.Windows(1).Caption
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ReturnValue As Integer

If ohneabbrechen = True Then
'ReturnValue = MsgBox(“Close Program?”, vbYesNo + vbQuestion, “Program”)

ReturnValue = MsgBox(“register in new window.” & _
vbCrLf & “” & _
vbCrLf & “Save?”, vbYesNo + vbQuestion, “Program”)

Select Case ReturnValue
Case vbYes
exportieren
Case vbNo
End Select
ThisWorkbook.Saved = True
Dim RetVal
RetVal = Shell(PathToFile(“Program.exe -enterkey”), 1)

Else

ReturnValue = MsgBox(“Save?”, vbYesNoCancel + vbQuestion, “Program”)
Select Case ReturnValue
Case vbYes
Call exportieren
Case vbCancel
Cancel = True
Case vbNo
End Select
ThisWorkbook.Saved = True

End If
End Sub
 
TankPro said:
I tried to compile my workbook on the other computer, but I’ve got another error message when clicking the ribbon menu in my EXE file.
Which error this time?
 
In excel 2016, I got a error message as following.

The macro cannot be executed. Macros are not available in this workbook or all macros may not be available.
 
Hi,
I made a very simple macro as followings for the test, and link it to custom UI. It works well in excel file, but it has also same error message in complied program.

Sub UI_test_Click()
MsgBox (“Hello”)
End Sub

Error Message : The macro cannot be executed. Macros are not available in this workbook or all macros may not be available.
 
Hello,

i still have problems with v2021.0 and my custom ui.
msgbox will be displayed 2 times and
RetVal = Shell(PathToFile(“customui.exe -enterkey”), 1)
doesnt work anymore.

can i send you my file for review?

Thanks
 
Last edited:
Problem with Shell(…) fixed.
No clue (yet) for the double msgbox but you could add some variable check to detect whether the msgbox was already displayed or not.
 
Back
Top