I have a VS 2013 Express system that uses an Access db. After populating the db with values, I open a report object created in Access. This all worked perfectly approximately 1 year ago. Now, in development or production, trying to open the report throws an error.
The code behind the form is:
Imports Access = Microsoft.Office.Interop.Access
Public Class frmReports
Public db_path As String
Dim oAccess As Access.application
And the code behind the button that opens the report is:
Private Sub btnSumByPlan_Click(sender As Object, e As EventArgs) Handles btnSumByPlan.Click
oAccess = CreateObject("Access.Application")
oAccess.visible = True
oAccess.opencurrentdatabase(db_path)
oAccess.docmd.openreport(ReportName:="rptSumByPlan", view:=Access.AcView.acViewPreview)
End Sub
However the code fails on the CreateObject line with the following error:
An unhandled exception of type 'System.Exception' occurred in Microsoft.VisualBasic.dll.
Additional information: Cannot create ActiveX component.
I have the following COM references selected:
Microsoft Access 12.0 Object Library
Microsoft ActiveX Data Objects 2.8 Library
Microsoft Office 12.0 Object Library
Microsoft Visual Basic for Applications Extensibility 5.3
I have tried selecting different versions of the Access, Office and ActiveX libraries but still get the same error.
I'm not positive, but I think I was running Office 2010 a year ago and now Office 2013.
Can you tell me what I'm doing wrong?
Thanks in advance.
Related
I am using Visual Studio 2019 and installed "Microsoft.Office.Interop.Excel V 15.0.4795.1000" using Nuget.
When I generating excel report it is working fine with "Microsoft Office 2013". But, getting error message with "Microsoft Office Home and Business 2019".
Error Message : Exception from HRESULT: 0x800A03EC Exception : System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC
I assume that Interop Excel V 15 is not supporting with office 2019.
I used below code to create excel application.
using ExApp = Microsoft.Office.Interop.Excel;
ExApp.Application xlApp = new ExApp.Application();
Later, I also tried with below code thinking that it will work with multiple versions of excel.
Type ExcelType = Type.GetTypeFromProgID("Excel.Application");
dynamic xlApp = Activator.CreateInstance(ExcelType);
Is there a way we can generate excel report in c# on any version of excel (2007 to 2019)?
At least, I need solution for "Microsoft Office Home and Business 2019".
I am converting a Visual Studio 2010 macro to work in an addin. I am using VB. How do I correct the line below:
Dim win As Window = DTE.ActiveWindow
which gives this error:
Error 3 Reference to a non-shared member requires an object
reference. C:\Users\Frank\documents\visual studio
2010\Projects\MyAddin2\MyAddin2\Module1.vb 28
The DTE is passed via the Application parameter in IDTExtensibility2.OnConnection. This method is called when the AddIn is initialized by Visual Studio.
The AddIn project wizard should have generated some code that casts the Application parameter to a field of type DTE2. Use that field to access the ActiveWindow property.
Whenever i try to record an action in a coded UI test , the action is recorded but as soon as i try to generate the code an error pops up saying
"Object reference not set to an instance of an object"
The recording was working fine till yesterday so there is no issue of visual studio version or service pack. I am using visual studio 2010 ultimate.
I've created a SQL 2008 database project in Visual Studio 2010. I have imported existing tables and stored procedures using both of the available methods of import (script or connecting to db). Regardless of which method I use, after the import completes I see my table files in the Visual Studio project, however, I get the following error when trying to view the object by double clicking on it:
Object reference not set to an instance of an object.
I can also see the files I am trying to access on the hard drive. Perhaps this is a permissions issue masked with an obscure error message? I've done some research and am stumped at this point. Any assistance is greatly appreciated.
Details on Visual Studio 2010: Version 10.0.40291.1 SP1Rel
My OS is: Windows Server 2008 R2 Standard
Thanks!
Starting VS 2010 with "devenv /ResetSkipPkgs", should help, mostly due to the "non-loading problem" of some of the key modules.
I'm working on a Classic ASP (with VB Script) project where I'm instantiating an object from an ActiveX control like so:
Dim objHelper
Set objHelper = Server.CreateObject("HelperLib.HelperObj")
Visual Studio 2005 provides intellisense for the first "layer" of properties and methods, but it can't seem to see properties and methods that are members of the main objects. For example:
objHelper. 'Properties and methods show up after the period '
objHelper.FirstProperty. 'No properties and methods are shown after the period'
Is there a way to "help" Visual Studio in some way to see these object types so that I can work in a more strongly-typed environment?
Unfortunately, 2005 does not do this. 2008 does a very good job of it, however. Once you install sp1, that is.