Developing Microsoft Word add-in for MAC - macos

I have developed a small add-in for Microsoft Word 2011 in VB.net using VS2012. I would like to port the functionality to Mac users. Can you tell me how can it be done?
I have already read these posts:
Developing Word add-ins for Macintosh
VB macro or office addin for mac
But they are referring to Word 2008/2010 where it wasn't possible. I know that since Word 2011 it's possible to use VBA on Mac. But I cannot find any documentation how to use it - all links pointing to msdn/microsoft pages don't exist anymore (like the ones mentioned here: Where can I find the Mac Office 2011 developer details?).
Do you have any resources (documentation, tutorials, books) about the topic?
If it's not possible using VB.net I can switch to C#, but I haven't seen any posts about C# support for MS-office for mac.

The short answer is that you cannot use Visual Studio to develop add-ins for MS Word 2011 and you'll have to use VBA within Word. I assume in your question you mean VB.net in VS2012 not VBA (Visual Basic for Applications is the code written within the Office programs themselves and can't be written in VS). Since VB.net and C# use the .Net framework which is not available for OSX, it is not possible to use VS.
The best you can do is write your VBA code in a Word template (ie .dotm) that exposes your macro through a toolbar (you can't modify the hybrid ribbon in Office 2011). You'll probably also have to use AppleScript (or even C/Objective-c) to make up for some of the short falls in Mac VBA. Things like FileSystemObject, ActiveX controls don't exist and File Dialogs are limited so if possible you'll need to find AppleScript equivalents (which can easily be run from VBA).

Related

Creating a Visual Basic 6 project from existing code in Visual Studio 2022 results in millions of compilation errors

Trying to do this on Windows 10.
I have a VB6 folder and I'm trying to make a solution out of it.
Visual Studio succeeds in making a project, but when trying to compile it gives millions of errors (see image).
I've read conflicting info about VB6 support in Visual Studio.
On one hand it's written that Visual Basic is supported, but not VB6?
There also used to be a VB6 IDE, but I can not find a download for it.
Should I use Visual Studio 2008 or something?
What are my options?
Thank you.
When Microsoft today uses the abbreviation "VB", they usually mean "VB.NET", the successor of classic VB published by Microsoft in 2002. According to this source, the latest version of VB, called VB6, appeared in 1998, and 10 years later Microsoft dropped any support for VB6 and its IDE.
Unfortunately, VB.Net is not backwards compatible to VB6, it is a different programming language (though it has some properties which arguably make it easier to port VB6 to VB.Net than to other .Net languages like C#). You cannot compile VB6 programs directly with Visual Studio 2002 or later, you usually need the original VB6 IDE. That leaves you basically with two options:
Try to find a copy of the old VB6 IDE and compile the program with it (if you cannot get it from where you got the source code, according to the comments, you may have luck at Microsoft, when you have the right developer subscription level).
Port the VB6 application to VB.Net. For this, however, you should have some not-too-basic knowledge of both languages, know the differences and ideally have an environment where you can test the original application against the ported one. I did this by myself in the past for some applications, so I know it can be less effort than recreating an application completely from scratch. However, this depends a lot on the specific application, how large and complex it is, how large the UI parts are and which kind of 3rd party components were involved. To be honest, if the application is not trivial, you should have a VB6 IDE for this approach, too.
Note also when your old VB6 code uses 32-bit third party OCX/ActiveX components, for porting it to VB.Net I would recommend to use VS2019 or an earlier version, not VS2022. The current Winforms Designer of VS2022 is not compatible with 32 bit OCX components any more, and it is unclear if MS will ever publish a version which will be.

tools available to run a vb 6 projects?

i have a vb 6 prroject itried to open it on vs 2013 by installing extension name as vb 6 for visual studio from console manager now i the error is that extension is not compatible so i google that its mean vb 6 project cannot be upgraded so instead of wasting time i am asking is there any tool to run vb 6 win form gui app so that i can open my source code , can you give me that downloading link of tool too
i have extension frm , with my forms in vb 6 so please
as vb 6 is not a part of .net technology so it will never run on visual studio
Simple answer: VB6 is long past end of life from Microsoft.
None of Microsoft's existing tools will even read VB6 sensibly. VB.net is NOT VB6 in any way or form.
If you want to develop/enhance/extend a VB6 program, you need a VB6 development environment. Some say this is available via MSDN. Otherwise it is pretty hard to find.
As a practical matter, if you want to move this VB6 program to a modern language, you'll need to find a migration tool/vendor/service that understands VB6 to do this for you, or do it yourself (which usually fails unless the project is really small). And yes, converting the forms is hard.
Even if you fork over the cash for an MSDN subscription to get access to the necessary tools it takes time to develop proficiency in a new language and those tools for using it. Many companies take the smarter path and hire a contractor with both the tools and the experience to handle maintenance of their legacy VB6 portfolio.
This saves the expense of porting such applications to another language and limits the risk of such a port having data-destroying flaws.
You could use VS2008, but you'll probably still have a lot of work to do.
Depending on what you need this VB6 code for, you might be able to copy it into the VBA (Visual Basic for Applications) section of a Microsoft Office document. As I understand it, VBA is nearly identical to VB6 from a programming-language and capability point of view.
Note that this would not allow you to compile code to a standalone EXE or DLL, but if you don't need to do that it might be an acceptable workaround for not having the VB6 development tools.
Here is a link to Microsoft's primer on VBA: MSDN VBA Primer.
Also, be aware that most VB6 source code files (excepting FRX files) are plain text so if you just need to read them, you can use any text editor.

How to code in Visual Studio 6.0 without UI editor

I'm new to Visual Basic. I have done some tutorials in Visual Studio 2010 and I am working with Visual Basic 6.0.
I don't know where I can write code the way I did in VB 2010. Instead of the code editor that was available in Visual Studio 2010, I get a UI editor, where I can add buttons. How can I simply write some Visual Basic code?
In VB6, there is a code view. If you double click the button it will take you to the click event in the code view for instance.
If you create modules.. (.bas file extension), you can write stand alone code. It's also possible to create an activex dll project to write code components. I used to do this, register them with com and then call them from ASP pages on NT4 servers back in the day.
VB6 predates the .NET framework though. It's much different than what you've learned in Visual Studio 2010. None of the .NET libraries are there and there are some syntax differences as VB.net is more strict than VB6 is.
You code use other editors alongside VB 6's editor like Notepad ++ and Sublime Text if you are really good in VB othersise just stick to it. Its very cool and people are making world class apps with vb6 check planetsourcecode.com you see wonders

Outlook scripting in C#?

I'm using Outlook 2010. Via the Developer ribbon, I see that I'm able to script Outlook using VBA. I'm also aware that you can create Outlook addins through COM that can pretty much have anything as their source language (C# / .NET included).
However, is there any way to actually code extensions to Outlook using built-in Outlook functionality using C#, rather than VBA? If not, are there any plans for Microsoft to allow this in future versions of Outlook?
I'm not sure what you mean by "built in" functionality. Addin can access anything VBA can access AFAIK.
Are you talking about converting the VBA editor to c sharp?

What is the VS 2008 IDE Written in?

I tried to search but if this is a duplicate it is hidden by some noise. Alternate title to the question:
What skills to look for when needing integration with the Visual Studio IDE?
Visual Studio 2008 is written in both native and managed code, though the bulk is written in C++. There are several pieces of Visual Studio that have always been written in managed code (e.g. the property browser, the WinForms Designer). And of course, Visual Studio 2008 is stitched together with COM.
In Visual Studio 2010, there is an effort to move more of the IDE to managed code. The text editor and the shell (i.e., menus, toolbars, document and tool window frames, etc.) are written in C#. In addition, pieces of the C# and VB IDEs are being written in C# and VB respectively. The new language, F#, is written completely in managed code -- the compiler, the language service, the project system, etc. -- are all written in F#.
You can use C#, VB or C++ to integrate with Visual Studio 2008. However, given that Visual Studio is built on COM, a good understanding of COM/ATL will be helpful. In addition, if you choose to use a managed language, a knownledge of COM interop and mixed-mode debugging will be extremely helpful. Note that there are a few levels of VS integration:
Macros -- the simplest way to run custom code in the IDE.
Add-in -- A simple but powerful way to build custom functionality into the IDE. With an add-in, you can create custom commands, listen to events, manipulate text in the editor, etc. However, you cannot add, say, a new language or editor to the IDE with an add-in. For many purposes, an add-in works fine.
Package -- this is the same level of integration as Microsoft's features use. With a package, you can create pretty much anything in the Visual Studio IDE, including adding new languages.
You should note that these become progressively more complex to author and deploy.
In Visual Studio 2010, a new form of extensibility is being introduced in several areas of the IDE, but primarily for extending the new WPF text editor. Going forward, integration with Visual Studio will require MEF (Managed Extensibility Framework) components rather than COM. So, in VS 2010, extending the text editor will simply require authoring a MEF component in your favorite managed language.
The podcast Herding Code episode #48 features an interview with Dustin Campbell, a program manager on the Visual Studio Managed Languages Group.
In that interview he talks for several minutes about this exact issue and gets into details about why the changes in 2010 are breaking compat with 2008 and how the future looks.
If this is strictly a curiousity question the other answers are correct. But if you want to dig a little deeper, listening to the podcast would be well worth your time.
At least the following languages are used inside of Visual Studio 2008
C++
C#
VB.Net
C
C++/CLI
C++ with managed extensions
Probably a few others that I forgot about.
A mix. The core is C++/COM stuff, but a lot of the newer stuff is managed code (C# etc). Due to the core being C++/COM (with a pile of code 'borrowed' from MS Office), VS integration is a funny experience.

Resources