{System.__ComObject} properties in Visual Studio debugger not the same as Excel VB - vba

I've been trying everything for a week and I cannot find a soltion for this. The problem is that I have been automating process in CATIA with Excel VB and now I want to use Visual Studio 2015. The only problem that I have is the debugger in Visual Studio. When I use:
Dim CATIA As INFITF.Application = GetObject(, "CATIA.Application");
I have a {System.__ComObject} as a result, clicking on "Dynamic View" (Debugger/Locals) I dont get any propertie of the object. If instead of CATIA.Application, Excel.Application is used I can see in the "Dynamic View" the different properties of the object.
http://stpserver.webcindario.com/vstudiodebugger.png
Also when I type the code:
Set CATIA = GetObject(,"CATIA.Application")
In Excel VBA, in the debugger it will appear all the properties of the object.
http://stpserver.webcindario.com/excevbadebugger.png
My question is how I can see in the Visual Studio 2015 debugger window the properties of the CATIA object as I can see them in Excel VB debugger.
PD: I have imported all the necessary references in Visual Studio 2015

Related post: Use C# for Catia V5 Automation
Sadly I do not know the exact VB.net code you will need but this should point you in the right direction. Since you want the COM object the process is the same, only the syntax is different.
In your Visual Studio project right click and Add Reference. Under the COM tab, Type Libraries section look for: CATIA V5 InfInterfaces Object Library. This is needed for INFITF.Application. If you want to work with other objects in Catia you will need MecModInterfaces, PartInterfaces, ProductInterfaces, and for HybridShape types you will need the CATGSMIDLItf Object Library (This has a different name prior to R23 but I do not remember what it was).
After that you need to use Marshal to attach to the Catia process.
The version of Visual Studio should not matter since you are using COM. It does matter if you are using CAA-RADE which has version specific tools.
I have successfully used Visual Studio 2010 (with Catia R19-20), VS2012 (with Catia R22 and R23), VS2013 and VS2015 (with Catia R23).
I think your problem might be with the missing references.

Latest version supported by Dassault Systemes for their CATIA (by the way, which version? what OS?) is VS2013 (hope I'm not doing a mistake).

Related

Unable to de-highlight on PowerPoint 2019 through VSTO plugin

Do not have enough reputation to comment on the answer by "Aleksey Malov" to query at un-highlighting text.
Preconditions: PowerPoint 2019 or 365. Presentation must be opened with window.
Original shape with highlight:
I'm opening a new PPT file from the VSTO plugin by saving a copy of original PPT file and then performing the following operations on selected shape object. I'm trying to do this using PowerPoint VSTO plugin with Office 2019. This works for me during debugging through Visual Studio but not through the installed plugin.
if(Application.CommandBars.GetEnabledMso("TextHighlightColorPickerLicensed"))
Application.CommandBars.ExecuteMso ("TextHighlightColorPickerLicensed")
My queries:
What does "Presentation must be opened with window." mean?
Why does it not work in the installed plugin?
If I attach the running PowerPoint process in Visual Studio even with Release config, I get expected result where highlight is removed. Any reasons why?
What does "Presentation must be opened with window." mean?
In the code you are relying on the CommandBars object which may not exist until the window is created. To get the code running correctly a window must be initialized.
Why does it not work in the installed plugin?
Well, you need to add some logging statements to see why YOUR code fails. Only looking at the log files you may find any difference.
If I attach the running PowerPoint process in Visual Studio even with Release config, I get expected result where highlight is removed. Any reasons why?
There can be multiple reasons. One of them is that VS could be run with admin privileges which causes all child processes to be run under the same security context. Files may not be accessible without admin privileges and etc.

VSTO Sample code For Sensitivity label Ribbon Item OnClick Events in C#

I need to get changes to a sensitivity label done by clicking the Ribbon item in Microsoft Word.
Does anyone have sample code on catching event changes for sensitivity labels in particular for VSTO C#?
We are using ribbon XML and not ribbon designer and extending AddInBase to start up the word application.
I have tried Document events. I have tried Commands.
Any help will be greatly appreciated. I can't find much documentation for VSTO
These are some VBA references.
You can try using the Document.SensitivityLabel property on ThisDocument/ActiveDocument and listen to the SensitivityLabel.LabelChanged event
The answer is a mixture of #cs answer and #Dimitry's answer (I don't have enough reputation points to mark that your comment was very useful). So thank you very much both of you for your assistance
VSTO no longer has support, so visual studio office tools include interop dll v15.0.0 for .net framework version 4.7.2. On our development machine, we have office 365, which from what I read means the latest interop dll will be installed as part of the installation process which has Microsoft word object library v 16.0
Adding Lastest interop to Visual Studio as a com reference
However visual studio still did not update the interop interfaces. What I had to do was change the wrapper property in the csproject from
<WrapperTool>primary</WrapperTool> to <WrapperTool>tlbimp</WrapperTool>
This updated the interfaces and allowed me to get access to the Document.SensitivityLabel object.
So thank you to all that commented it was greatly appreciated.

Reporting template in Visual Studio 2017

The Reporting template seems missing in VS2017 (I am using Visual Basic). Any way to get it back?
I have already tried installing SQL Server Data tools and the rdlc extension from the marketplace, but it still doesn't show up.
The template is available in the Add New Item window. Select Visual C# and then look for the Report and Report Wizard templates. These templates are only visible under Visual C#, not under any subitem.
Try updating ReportViewer to version 14.0.0.0 and installing Microsoft.RdlcDesigner. This worked for me for Visual C# and then just like J.Bunch said there is no sub item Reporting like there was before so you just scroll down thorough all items. Also try this although the example is for C# I think it should at least help you with VB.Net as well. Hope it helps.

Is it possible to write Excel VBA Code in Visual Studio

Is there a way to write VBA Code in Visual Studio. If not is there any other alternatives?
The best you can do is bend the office Visual Basic Editor (VBE) tool to your liking. If you stay in it's native environment you get the full power of error detection, Intellisense, live code running, etc.
My tips...
In the VBE go to Tools > Options > Editor tab.
Turn off 'Auto Syntax Check'. You still get code highlighted errors but no annoying popups.
Go to the Editor Format tab and change the Font to Consolas (Western), Size 11.
For code indenting install the awesome, free, Code Manager. It adds some sick keyboard shortcuts.
Make the Edit toolbar easily accessible for code commenting/uncommenting.
Use Rubberduck to add unit testing, source control, code inspections and refactoring functionality.
With those simple changes you end up with a half way decent, useful, and keyboard friendly environment to write your visually appealing code. :-D
VBA code for Excel can only be written inside Excel using the VBA IDE. VBA projects are stored as part of the Excel file and cannot be loaded into Visual Studio.
However, you can write VSTO (Visual Studio Tools for Office) managed add-ins for Excel using Visual Studio. The following MSDN page covers both developing with VBA and VSTO.
Excel for developers
You could also use the interop features of VBA to consume a (COM) object written in Visual Studio from your VBA code.
I've been looking for an answer to this question myself.
Best I've found myself is the option of exporting a Module ect from Excel with the code you've already written (or blank) and load that up in the Visual Studio Environment.
It doesn't offer much, but the highlighted text and auto indenting is nice and makes it much easier to read compared to the standard VBA environment.
Then once you're done just import it back into Excel.
There is a VSCode extension to do this.
It allows you to write code in VSCode and export it to Excel.
This extension is very useful when you develop in VBA.
Here's the link to download the XVBA extension
Edit :
As Peter Macej said in comment, this solution only works for Visual Studio Code not for Visual Studio
You can certainly add and edit a VBA file (.vb) in your Visual Studio solution, but the intellisense will be worthless/screwed up.
This extension for VScode would probably provide a much better experience: https://marketplace.visualstudio.com/items?itemName=spences10.VBA
If your goal is have your VBA code exposed to source control so you can track changes, then it's still worth it to include in your Visual Studio solution, but just store that VBA code in a plain text file and then use the Excel interop to load it into the appropriate module within the excel workbook, e.g.:
xlWorkbook.VBProject.VBComponents["ThisWorkbook"].CodeModule.AddFromFile(#"C:\PathToYour\VBAcode.txt");
And there are other methods to delete/replace code lines, etc....
You can try xlWings package for python and use it with VS Code https://youtu.be/xoO-Fx0fTpM

How can I browse the classes and methods of an ActiveX DLL?

Basically, what I want to is be able to explore an ActiveX DLL.
I normally fire up VB 6, add the DLL to the "References" of the project, and use Object Explorer.
However, in this particular machine I can't install VB / VS.
I'm sure there's a tool out there that does this. Does anyone know of one?
Thanks
If the machine has Microsoft Office installed, you can go into the built-in Visual Basic for Applications IDE and load the object there:
Tools menu -> Macro -> Visual Basic Editor (or press Alt+F11)
Then when inside the VBA window, Tools menu -> References -> Browse to locate your DLL
and View menu -> Object Browser to view the object's content (or press F2)
I've used Microsoft's OLE/COM Object Viewer for this. It used to be installed with older versions of Visual Studio, and is still part of the Windows SDK.
It also seems to be available separately -- this is from an older version of the Windows SDK, but I don't imagine this tool has changed much recently.
To view the type information for a particular DLL or OCX, File, View TypeLib... is the option you're looking for. You can also dig through the Controls group in the main window to view details on a registered control. Right-click the entry for the control and click View Type Information to see details on the types and methods it exposes.
This will show rather more information than VB6 would. If you're looking at an ActiveX control, the coclass and dispinterface sections of the type library display are the things to look at.
(There's also an Expert Mode option in the View menu -- this will show you pretty much everything stored in the Registry to do with COM, OLE and ActiveX. This is generally rather a lot of information...)
Is it possible to download the component from that machine and examine it locally in Visual Studio? (That'd be my first suggestion.) (And BTW, the .NET versions of Visual Studio also feature a VB6-like Object Explorer which works nicely for this.)
Alternatively, and it's not free, but you might try ActiveXplorer. (I haven't tried this, but it looks promising.) (Discontinued)