Home » excel » excel – MS Office – ActiveX Buttons switching places

excel – MS Office – ActiveX Buttons switching places

Posted by: admin April 23, 2020 Leave a comment

Questions:

There are several instances of this problem, but this one is predominant. This is in relation to updates (our most notable problem child being KB2726958). We have a Leave Spreadsheet that looks like this:

Leave Spreadsheet example

By pressing the grey Leave button, you end up here:

Leave Word doc

All the programming for these is written in VBA (i’ve never worked with VBA before, I can understand it to a degree).

Now, the issue is that using the ActiveX button in the ‘Leave Spreadsheet example’ causes the 2 buttons ‘Send by Email’ and ‘Save’ to switch functions; Send by email attempts to save and save opens up Outlook and creates the email message.
Both functions have completely retained functionality, just on the wrong buttons.

The thing I find weird is that a hyperlink to the very same file works; the buttons aren’t switched and have full functionality. The only hint that I have towards resolution is that when using a hyperlink, it’s directly opening the file. When using the ActiveX button, it seems to be creating a new file based off the file it’s linking to. For example, the hyperlink directly opens C:\Report.dotm but the ActiveX button opens Document1.doc with a template based on Report.dotm.
I’m considering that maybe the activeX button is opening up Word with an incorrect extension? But i’m not sure how to figure this out (code below shows that the linked file on the activeX control is a .dotm).

What further throws a spanner into the mix is that it only affects some computers… Considering on-site we all use the same type of PC with the same image… 🙁

My question is, does anyone know why they may be swapping? They’re located on the same network drive albeit different directories. They require the same permissions to access. The code for the buttons is as follows:
Excel Button:

Private Sub CommandButton1_Click()
' This button links the excel spreadsheet to the word doc
    Dim wrdApp As Object
    Dim wrdDoc As Object
    Dim i As Integer

    Set wrdApp = CreateObject("Word.Application")
    wrdApp.Visible = True
    Set wrdDoc = wrdApp.Documents.Add("\networkdrive\directories\Request for Leave.dotm")
End Sub

Word buttons 1 and 2:

Private Sub cmdSend_Click()
' This is the code for the button 'Send by Email'
    MsgBox "Send the following email to your Team Leader/Line Manager", vbInformation
    SendDocumentAsAttachment "", "IPL Request for Leave"
End Sub

Private Sub cmdSave_Click()
' This is the code for 'Save'
    modSend.SaveLeaveForm
End Sub

Please Note: The comments above are not in the code in VBA, i’ve written them in myself in this question to provide clarity.

Troubleshooting that i’ve done:
Removing all .exd files
Running the MS Hotfix (removes all .exd files in a GUI)

The next step would be to try running all 6 patches related to fixing ActiveX controls with the particular patches we’ve done to see if that fixes the problem. The reason I haven’t done this yet is because of ITIL (Change management) although I may try testing this later today.

What is the outcome i’m after?
Ideally, I want to understand what is causing these buttons to, from what it looks like, swap their functions. I have different scenarios of button swaps, some of which are remedied by removing the .exd files, and some that aren’t.
By understanding what is happening, I hope that I can apply the knowledge to the other scenarios (same problem, different coding).
Then, I’ll be able to document my findings so that when we perform the next round of patching that is known to break ActiveX controls, my organization will know how to deal with it.

How to&Answers:

So the patch mentioned below has fixed this issue. There’s still some other issues that I need to test this patch against, but I definitely should have started there. Lesson learnt.

From my work email:
I’ve just tried using the patch related to the ActiveX controls breaking, KB2920754. I’ve used it on two PC’s here in the training room; both had different issues:
– The first one had buttons that had switched around (save attempted to email, email attempted to save)
– The second one couldn’t use the buttons at all.
This patch cured both w/o requiring a restart or logging out and back in. I didn’t remove any .exd files, either.
It does state, however:
“Important For this fix to be fully effective, you also have to apply the other patches for Office 2013 that are listed in the “Resolution” section of the following Microsoft Knowledge Base article”
There are 6 in total.
Patches:
1. KB2920754 – (the one I’ve used successfully)
2. KB2956145
3. KB2956163
4. KB2965206
5. KB2956176
6. KB2956155