Hi all,
I have a workbook that i have been working on for a while now that contains quite a lot of code, several tables and a lot of data. Recently on opening the file i have been getting an error (Exception from HRESULT: 0x800A03EC) when i click ok the woorkbook seems to be working just fine. Part of the code i have used is to hide the excel menus, and remove borders from userforms.
Hide excel menus.
Private Sub Workbook_Open()
ThisWorkbook.Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"
ActiveWindow.DisplayWorkbookTabs = False
Application.DisplayStatusBar = False
End Sub
Remove userform header and border.
Private Declare PtrSafe Function FindWindow Lib "User32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetWindowLong Lib "User32" _
Alias "GetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLong Lib "User32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "User32" ( _
ByVal hwnd As Long) As Long
Sub RemoveCaption(objForm As Object)
Dim lStyle As Long
Dim hMenu As Long
Dim mhWndForm As Long
If Val(Application.Version) < 9 Then
mhWndForm = FindWindow("ThunderXFrame", objForm.Caption) 'XL97
Else
mhWndForm = FindWindow("ThunderDFrame", objForm.Caption) 'XL2000+
End If
lStyle = GetWindowLong(mhWndForm, -16)
lStyle = lStyle And Not &HC00000
SetWindowLong mhWndForm, -16, lStyle
DrawMenuBar mhWndForm
End Sub
Each userform has the below code.
Private Sub UserForm_Initialize()
Call RemoveCaption(Me)
End Sub
I also have a connection that just duplicates a table, one table shows all data and the duplicate is filtered.
I am running
Window 10 64bit
Excel 2016
I have attached a log file of the error.
Any body have any ideas
Bookmarks