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
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