![]() |
|
|
| Subject:
Tab Replacement Macro for Visual Studio 2005
Category: Computers Asked by: kristoph-ga List Price: $15.00 |
Posted:
23 Jul 2006 14:52 PDT
Expires: 22 Aug 2006 14:52 PDT Question ID: 748830 |
I need a macro, for Microsoft Visual Studio 2005 Express Edition, that will replace all instance of the tab character in a file and replace it with 4 spaces. You do not need to writ this macro, just point me to a download location. |
|
| There is no answer at this time. |
|
| Subject:
Re: Tab Replacement Macro for Visual Studio 2005
From: dksluu-ga on 23 Jul 2006 21:19 PDT |
Hi Kristoph,
This is the macro I came up for search & replace. Do you require the
macro to perform the search & replace on a specific document, the
active document or all documents? The macro below is for a specific
document named "Default.aspx". Change the 3rd line of the procedure
if you need to specify a different document.
------------------------------------------------------------------
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module RecordingModule
Sub TabToSpacesMacro()
DTE.ExecuteCommand("Edit.Replace")
DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
DTE.Windows.Item("Default.aspx").Activate() 'Document to search
DTE.Find.FindWhat = "\t"
DTE.Find.ReplaceWith = " "
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End If
DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Close()
End Sub
End Module
--------------------------------------------------------------------
David Luu |
| Subject:
Re: Tab Replacement Macro for Visual Studio 2005
From: njovin-ga on 04 Aug 2006 17:02 PDT |
replace(chr(9)," ") will do the trick, nothing fancy. As for accessing the file, it depends on where it is and if you want to give the user a "Browse" dialog, but the replace statement is the crux of it. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
| Search Google Answers for |
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |