Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / August 2005

Tip: Looking for answers? Try searching our database.

VS 2003 macro conversion to VS 2005 macro - documentation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank - 25 Aug 2005 22:58 GMT
I am trying to convert some Visual Studio 2003 macros to run under
Visual Studio 2005 Beta 2.

Is there any documentation that outlines what, if any, changes need to
be made?

I am having trouble with the creation of some tool bars. My code uses
"Imports Microsoft.Office.Core" and I don't see any Office entries when
trying "Add Reference". (I have installed the Office 2003 primary
interop assemblies.)

Should I be able to get this working in the VS 2005 Beta 2?

Thanks,

Frank
"Gary Chang[MSFT]" - 26 Aug 2005 09:28 GMT
Hi Frank,

>Is there any documentation that outlines what, if any,
>changes need to be made?

You needn't to care about this, most of the VS 2003 macro could be used in
VS 2005, actually there is not any big change in VS2005's Macro syntax, we
don't have a specific doc on this topic.

>I am having trouble with the creation of some tool bars. My code uses
>"Imports Microsoft.Office.Core" and I don't see any Office entries when
>trying "Add Reference". (I have installed the Office 2003 primary
>interop assemblies.)

yes, currently the .NET Framework 2.0 directory doesn't contain the Office
2003 interop assembly. you may try to copy it manually, from the GAC
directory:

C:\WINDOWS\assembly\GAC\Office\11.0.0.0__71e9bce111e9429c\Office.dll  

to
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50630

Wish it works!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Frank - 26 Aug 2005 19:16 GMT
Gary Chang[MSFT] wrote:
> Hi Frank,
>
[quoted text clipped - 32 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.

Gary,

I copied Office.dll as you suggested, and used regasm.exe on Office.dll.
That seemed to correct the error with the "Imports..." statement.

However, when the macro tries to add a command bar, I receive this error:

Unable to cast COM object of type 'System.__ComObject' to interface type
'Microsoft.Office.Core.CommandBar'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{000C0304-0000-0000-C000-000000000046}' failed with HRESULT: 0x80004002
(No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE))).

Here is the macro code where the error occurred (on cmdbar = line):

    Sub CreateToolbar(ByVal name As String)
        Dim cmdbar As CommandBar
        cmdbar = DTE.Commands.AddCommandBar(name, _
                  vsCommandBarType.vsCommandBarTypeToolbar)
        ' Show the command bar and its button.
        cmdbar.Visible = True
    End Sub

It looks like something is not registered. Do you have any suggestions
on how to correct this error?

Thanks,

Frank
"Gary Chang[MSFT]" - 27 Aug 2005 09:50 GMT
Hi Frank,

>However, when the macro tries to add a command bar, I
>receive this error:
>Unable to cast COM object of type 'System.__ComObject' to interface type
>'Microsoft.Office.Core.CommandBar'.

yes, it appears the office interop assembly isn't registered well.

But I don't have this problem in my side, I have tested your sample Macro
in the VS2005 IDE, it can add the new command bar as expected. So there may
be some else problem, could you browse all the contained Office interfaces
in the Object Browser of the VS2005's Macro IDE?
 

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.