VBA & C#

  • Thread starter Thread starter JPRoot
  • Start date Start date
J

JPRoot

Hi,

Is it possible to integrate VBA within a C# MDI application? If yes, is
there any exemples?

What I am trying to do is let the user of my app add any child windows he
would like to the MDI and customize their layout using VBA...

Any ideas?

Thanks
JPRoot
 
VBA is just a COM script engine, so in theory, it can be done. However, that
means you will end up creating a wrapper for the engine so you C# can host
and talk to it, and furthermore create wrappers for your .NET classes so VBA
(which uses COM) can use them. That's not going to be a happy marriage.

However, you can host the .NET runtime/comilers in your own app, and have
people write C# or VB.NET or J# or JScript code which you can execute at
runtime. Here's a starting place for Visual Studio for Applications
(basically, a .NET version of VBA):
http://msdn.microsoft.com/msdnmag/issues/02/08/VisualStudioforApplications/default.aspx

-Rob Teixeira [MVP]
 
Hi JPRoot,

Thank you for posting in the community! My name is Jeffrey, and I will be
assisting you on this issue.

Based on my understanding, you write a MDI application using .Net, and you
want to implement the similiar VBA function in you application: that is,
open a code editor and enable the application user to write VBscript code
and execute it runtime.

=====================================================
Actually, there is Script for the .NET Framework that is the .NET
equivalent of Windows Script. So you can use VSA in you .Net application.
You may try to use the script VSA engine to executive the script code, then
invoke your application's related function for the related script code.
For more information, please refer to the 2 articles below:
http://www.csharphelp.com/archives/archive102.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/ht
ml/scripting06112001.asp

=====================================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks Jeffrey

Where can I get Visual Studio for Applications (VSA) SDK Beta 2

Thank
JPRoo

----- \"Jeffrey Tan[MSFT]\" wrote: ----


Hi JPRoot

Thank you for posting in the community! My name is Jeffrey, and I will be
assisting you on this issue

Based on my understanding, you write a MDI application using .Net, and you
want to implement the similiar VBA function in you application: that is,
open a code editor and enable the application user to write VBscript code
and execute it runtime

====================================================
Actually, there is Script for the .NET Framework that is the .NET
equivalent of Windows Script. So you can use VSA in you .Net application
You may try to use the script VSA engine to executive the script code, then
invoke your application's related function for the related script code.
For more information, please refer to the 2 articles below
http://www.csharphelp.com/archives/archive102.htm
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/h
ml/scripting06112001.as

====================================================
Please apply my suggestion above and let me know if it helps resolve your
problem

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance

Best regards
Jeffrey Ta
Microsoft Online Partner Suppor
Get Secure! - www.microsoft.com/securit
This posting is provided "as is" with no warranties and confers no rights
 
AHA!

I just knew this would come up sometime. I tried this earlier in
the vstudio.general newsgroup without any replies (so far).

Original post:

I was initially going to post this in the .vsa group, but there is very
little action there. If it would be better posted elsewhere please
let me know.

I've been looking into this the better part of a day, Googling and
the whole bit, but I can't seem to find a satisfactory answer.
When I "discovered" the vsa classes I got excited, as this looked
like a way to implement scripting from within an application. Alas,
as I attempted to use others' samples, I discovered that this did
not seem to work anywhere near what I had hoped, and not even
close to what I expected. I have added references to:

Microsoft.VisualBasic.Vsa
Microsoft.Vsa

as well as several other libraries that look like they might belong.

I tried something simple at first like this:
class Scripter
{
private IVsaEngine eng;
eng = new VsaEngine();

eng.InitNew();
.....
}

with the correct "using" statments and all. Intellisense is working
for everything up until I type in "eng.", then nothing. So, I tried a
build right quick and keep getting messages about a return value
required for VsaEngine, invalid tokens '(' and '=', just normal
compiler complaints, but they don't make sense in this context.

A lot of this is based on samples from others that I have seen, and
they do the same thing, declare the field as an IVsaEngine, then
assign it a VsaEngine() type, but I'm just stuck here. I've registered
the vsavb7rt.dll, closed and restarted VS, nothing seems to get me
past this point.

Hopefully that will answer most of the obvious questions, I'm just
wondering if there is something else that needs to be done. VSA
appears to be a wonderful thing, if it works. If not, why the hell is
it even there? Or am I just missing a very fundamental thing here?
 
Hi jproot,

Thanks for your feedback.

I will confirm where is the VSA SDK public download link, and I will reply
to you ASAP.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi jproot,

It seems that VSA SDK is not public available and is discontinued now.
I am still finding the substitution for VSA, please wait for a little more
time, I will reply to you ASAP.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi jproot,

Sorry for letting you wait for so long time.

After contacting product team, it appears that the original VSIP SDK for
VS .Net 2002 contains the VSIP and VSA SDKs. The VSIP program was revamped
with VS .NET 2003, and the VSIP SDK is now publicly available through
www.vsipdev.com.However, it no longer contains the VSA SDK. So VSA SDK was
not publicly available now.

The product team feedback that they are working on the future version of
VSA SDK now.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top