473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Visual Studio macros - how to close a file

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.vsSaveChang esYes)
Next
End Sub
thanks in advance

Ian
Nov 17 '05 #1
4 1193
Ian wrote:
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
Nov 17 '05 #2
Ian
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

"Tom Widmer" <to********@hotmail.com> wrote in message
news:uP**************@TK2MSFTNGP14.phx.gbl...
Ian wrote:
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

Nov 17 '05 #3
"Ian" <ib******@yahoo.com> wrote in message
news:eH**************@TK2MSFTNGP15.phx.gbl...
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
Nov 17 '05 #4
Ian
Hi William,

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

Ian


"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:uI**************@tk2msftngp13.phx.gbl...
"Ian" <ib******@yahoo.com> wrote in message
news:eH**************@TK2MSFTNGP15.phx.gbl...
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

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Veerle | last post by:
Hi, I have 5 files open in Visual Studio .NET. When I try to close the second file, Visual Studio closes too. When I reopen Visual Studio and then try to close the second file, Visual studio...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
3
by: Rob Mayo | last post by:
I am working in an environment with 4 developers. 2 groups of 2 people working on the same server on the same web project with no version control management on the web server. Programmers A & B...
0
by: bernhard.nowara | last post by:
Hello, I found a bug in Visual Basic used with Visual Studio Macros (Microsoft Visual Studio 2005 + SP1). Description: If I apply the simple Visual Basic statement...
1
by: cnixuser | last post by:
Hello, I am having a problem that I believe is related to the way a stream reader object looks for a text file by default. What I am doing is using a StreamReader object to read the text of a text...
33
by: Ioannis Vranos | last post by:
A bit off topic, but does anyone know if Visual C++ 6 supports the 9899:1995, or only the 9899:1990?
1
by: Cramer | last post by:
I'm running XP Pro/SP2 + patches and updates, with Visual Studio Professional 2008 (and no prior installation of Visual Studio ever installed). When attempting to open an ASP.NET Web application...
0
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the...
3
by: Johnson | last post by:
I'm not sure if this is an IIS 5.1 issue or ASP.NET issue, or Visual Studio 2008 issue -- thus posting to 3 groups. Please don't be offended. The problem I'm encountering is that Visual Studio...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.