Visual Studio macros - how to close a file

  • Thread starter Thread starter Ian
  • Start date Start date
I

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.

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
 
Ian said:
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
 
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
 
Ian said:
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
 
Back
Top