User Forms and TaskPanes in Excel

Add-in Express™ Support Service
That's what is more important than anything else

User Forms and TaskPanes in Excel
 
ctorres29


Guest


Hi,

I have been working on developing an Excel AddIn with some User Forms, Task Panes, UDF, ToolBars and Ribbons. However, when I try to access the Excel objects from the User Forms or TaskPanes, I receive an Exception from HRESULT:
System.Runtime.InteropServices.COMException was unhandled by user code
ErrorCode=-2146827284
Message="Exception from HRESULT: 0x800A03EC"
Source=""
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Microsoft.Office.Interop.Excel.Range.set_Value(Object RangeValueDataType, Object ) at BUcpTaskPane.BUcpServerParametersDialog.Button1_Click(Object sender, EventArgs e) in D:BUcp2008AddinExpress3BUcpTaskPaneBUcpTaskPaneFormsBUcpServerParametersDialog.vb:line 51 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWin!
dow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ThreadContext.LocalModalMessageLoop(Form form)
InnerException:

Reviewing AddInExpress forums, I found the following code.

Dim MyHostApp As AddinModule = AddinExpress.MSO.ADXAddinModule.CurrentInstance
MyHostApp.ExcelApp.ActiveCell.Select()

I tried reinstalling both, AddIn Express and Visual Studio 2008 however the error still there.

Currently, I am working with Visual Studio 2008 Team System and MS-Office 2007.
Add-In Express 2008 for .NETv4.3.1910

Any suggestion?
Posted 23 Sep, 2008 21:18:05 Top
Eugene Astafiev


Guest


Hi Carlos,

Could you send us the sources to the support e-mail address (see Readme.txt)?
Posted 24 Sep, 2008 05:39:12 Top
ctorres29


Guest


Hi Eugene,

I can?t send you my whole project, because it needs to connect to a SQL database in order to work. However I tried in another project with a simple windows form and a simple button. The result was the same. I think that with a TaskPane the result must be the same also)

I will send you this simple project.
The code inside the windows form is like this:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim MyHostApp As AddinModule = AddinExpress.MSO.ADXAddinModule.CurrentInstance
Dim rng As Microsoft.Office.Interop.Excel.Range
rng = MyHostApp.ExcelApp.ActiveCell

rng.Formula = "=100+10"

End Sub
End Class


Posted 24 Sep, 2008 12:44:22 Top
Eugene Astafiev


Guest


Hi Carlos,

Ok. I will wait.
Posted 24 Sep, 2008 16:55:01 Top
ctorres29


Guest


Indeed, I already sent it to this same email address.
xxxx@xxxx.xxx
Posted 24 Sep, 2008 18:33:16 Top
Eugene Astafiev


Guest


Hi Carlos,

Don't publish any e-mail address on the forum. That is what spammers are looking for.

Unfortunately, the specified e-mail address doesn't exist. Please see the Readme.txt file.
Posted 25 Sep, 2008 01:36:22 Top
ctorres29


Guest


I suppose you refer the file in the Addin Express instalation folder.

Ok. I sent you the same file to this email address.
Posted 25 Sep, 2008 11:50:28 Top
Eugene Astafiev


Guest


Hi Carlos,

I have tested the add-in. It works fine for me. But I didn't find the adxloader.dll and manifest file in the Loader folder of your project. What version of adxloader do you use?

P.S. I have noticed that you don't release COM objects in the code. For example, an instance of the Microsoft.Office.Interop.Excel.Range class stays alive.
Posted 26 Sep, 2008 04:21:57 Top
ctorres29


Guest


Eugene,

Both files are in the folder you said (version 4.3.1910.0).
Do you think I am doing something wrong when I setup the project?

Could you send me the same sample project?

Posted 26 Sep, 2008 12:47:35 Top
ctorres29


Guest


Eugene,

Finally, I think the problem is solved.

For your knowledge database.
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q320369

Something related with the non-English language configuration in my computer. (spanish configuration).

If I would have any other problem, I will contact you.

Thank you.

:D
Posted 26 Sep, 2008 20:16:20 Top