<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - FILEOPERN XLSX Basic code to Enable Control does not work with Application.OnKey "^x" and Application.CellDragAndDrop"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=118224">118224</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FILEOPERN XLSX Basic code to Enable Control does not work with Application.OnKey "^x" and Application.CellDragAndDrop
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.2.0.0.alpha0+ Master
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>BASIC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kelemeng@ubuntu.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="http://bugs.documentfoundation.org/attachment.cgi?id=142856" name="attach_142856" title="Example file from Excel">attachment 142856</a> <a href="http://bugs.documentfoundation.org/attachment.cgi?id=142856&action=edit" title="Example file from Excel">[details]</a></span>
Example file from Excel

If we open the attached file (which contains a macro) with LibreOffice Calc we
get an Error message: “BASIC runtime error. ‘51’ Internal Error”. The Enable
Controls (Application.OnKey "^x" and the others) function does not work. When
we close the file we get another Error message: “BASIC runtime error. ‘423’
CellDragAndDrop”.

Steps to reproduce:
1. Create a new spreadsheet with Microsoft Excel 2016/2013
2. Add a value to a cell.
3. Open the Visual Basic window
4. Create a new module and copy the basic code which is in the attached file.
5. Try to copy a cell or drag a cell and drop. (It will work well)
6. Save the file as *.XLSM
7. Open in LibreOffice Calc. (You will got an error message). Here is a code
snippet:
Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
On Error Resume Next
For Each CB In Application.CommandBars
    Set C = CB.FindControl(Id:=Id, recursive:=True)
    If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

8. Try to copy a cell or drag a cell and drop. (It will work wrong)
9. Save as the file and open with Microsoft Excel.
10. Try to copy a cell or drag a cell and drop. (It will work well)

Actual results: We got two different error message (we should not) and the
enable control function does not work well.

Expected results:
We should not get any error message and these simple enable controls should
work well. 

Version: 5.4.3.2
Build ID: 92a7159f7e4af62137622921e809f8546db437e5
CPU threads: 4; OS: Windows 6.1; UI render: default; 
Locale: hu-HU (hu_HU); Calc: group

Version: 6.0.0.1.0+
Build ID: c678dc5309741097d9b0265f03dd279a8794d256
CPU threads: 4; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:libreoffice-6-0, Time: 2017-12-28_04:21:33
Locale: hu-HU (hu_HU); Calc: group</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>