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 / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Visual Studio macros - how to close a file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ian - 10 Mar 2005 18:18 GMT
I posted this message in the languages.VB newsgroup yesterday and did not
receive a response.  I am hoping it might receive one in this newsgroup.

I would like to implement a macro that makes rather extensive changes to the
names of variables/classes in a VC Net solution.  Macros are written in
basic and I have limited experience with both.  For learning purposes, I
would like to implement a macro that accesses all files in a VC Net 'test'
project and makes a series of changes to these files.  I am  able to
identify each file in my project and then open the file.  But I have yet to
figure out how to close the file.  Could someone kindly tell me how to close
a file?  The following BASIC code illustrates my first efforts:

Sub replaceMacro()
   Dim oItems As ProjectItems = DTE.ActiveSolutionProjects(0).ProjectItems
   Dim oI As ProjectItem
   For Each oI In oItems
           Dim oFilename As String = oI.Name()
           oI.Open(vsViewKindPrimary)

           ' close file
           '   the following line fails and generates the error message
           '  "Object reference not set to an instance of an object
           DTE.ActiveDocument.Close(vsSaveChanges.vsSaveChangesYes)
   Next
End Sub

thanks in advance

Ian
Tom Widmer - 11 Mar 2005 13:01 GMT
> I posted this message in the languages.VB newsgroup yesterday and did not
> receive a response.  I am hoping it might receive one in this newsgroup.

This group is for VC, Visual C++, so I think you are even less likely to
receive a reply here!

Tom
Ian - 11 Mar 2005 19:53 GMT
Hello Tom,

My entire application has been written using MS VC NET.  I am trying to use
the macro feature in MSVC Net to make changes to the source files.   The
macro is written in basic.   This newgroup seems to be just as appropriate
as the VB newsgroup.  Any other suggestions?

Ian

>> I posted this message in the languages.VB newsgroup yesterday and did not
>> receive a response.  I am hoping it might receive one in this newsgroup.
[quoted text clipped - 3 lines]
>
> Tom
William DePalo [MVP VC++] - 11 Mar 2005 20:02 GMT
> My entire application has been written using MS VC NET.  I am trying to
> use the macro feature in MSVC Net to make changes to the source files.
> The macro is written in basic.   This newgroup seems to be just as
> appropriate as the VB newsgroup.  Any other suggestions?

Perhaps a repost in

   microsoft.public.vstudio.extensibility

is in order as a good deal of the regulars of this group are are
"language-lawyers" <g> who probably don't do much in script languages.

Regards,
Will
Ian - 11 Mar 2005 22:46 GMT
Hi William,

Thanks for the suggestion.  I'll give it a try.   Have a great weekend.

Ian

>> My entire application has been written using MS VC NET.  I am trying to
>> use the macro feature in MSVC Net to make changes to the source files.
[quoted text clipped - 10 lines]
> Regards,
> Will

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.