Re: Format Project available?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



No, there is no option AFAIK, but you can do a simple macro like this (not
tested, just from my head):

Sub FormatAll
For Each objProject As Project In DTE.Solution.Projects
FormatProjectItems(objProject.ProjectItems)
Next
End Sub

Sub FormatProjectItems(colProjectItems as ProjectItems)
For Each objProjectItem As ProjectItem in colProjectItems
FormatProjectItem(objProjectItem)
' Enter in recursion for nested files
FormatProjectItems(objProjectItem.ProjectItems)
Next
End Sub

Sub FormatProjectItem(objProjectItem as ProjectItem)

Dim objTextDocument as TextDocument

Try
objTextDocument =
DirectCast(objProjectItem.Document.Object("TextDocument", TextDocument)
Catch objException as Exception
End Try

If objTextDocument IsNot Nothing Then
Try
objTextDocument
..StartEditPoint.CreateEditPoint.SmartFormat(objProjectItem.EndEditPoint)
Catch objException as Exception
MessageBox.Show(ex.ToString)
End Try
End If

End Sub

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

<rjack@xxxxxxxxxxxxxxxx> escribió en el mensaje
news:1134498916.219560.81000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> VS 2005 has nice menu options to format source code:
>
> Edit/Advanced/Format Selection
> and
> Edit/Advanced/Format Document.
>
>
> Is there an option to Format an entire project or solution? If not, is
> anybody aware of any macros or addins that will assist with formatting
> more than a single document?
>
>
> Thanks!
>


.



Relevant Pages

  • RE: Combining multiple IF statements
    ... Usually date will not work if the cells are not in date format. ... within this same macro id like to add many additional statements like ... Sub dr2() ...
    (microsoft.public.excel.programming)
  • Re: change entered information to time
    ... insert the current time and or date in the document with a macro. ... Word does not take numbers and format them ... Sub InsertUSFormatDate() ... Word MVP web site http://word.mvps.org ...
    (microsoft.public.word.newusers)
  • Re: Range to be copied changes
    ... Sub Last_Title_Web ... ' Last_Title_Web Macro ... I will be adding and deleting listings as time goes ... then I will delete a column and then I need to format the ...
    (microsoft.public.excel.programming)
  • RE: Concatenation within a macro
    ... Sub put_um ... I have a large data set that is automatically formatted by a macro. ... of this macro I need to concatenate sets of three cells into one and format ... matter if the macro attempts to format cells with no data in them. ...
    (microsoft.public.excel)
  • Re: What does this Macro do?
    ... change the duration format on tasks from hours to days to weeks or whatever. ... If I want them all in hours or all in days I'd run that macro and it can ... Sub Format_Duration ...
    (microsoft.public.project)