これが、私の aspx/aspx.cs フリッパーのマクロ ソースです。2005 年には動作しますが、08 では問題が発生する可能性があります。よくわかりません...これは私の他の cpp/h フリッパーから取ったものなので、最高の状態にするためにクリーンアップが必要になる可能性があります。私はマクロを書くことでお金をもらっていないので、マクロが必要になったらできるだけ早くそれらを爆破しなければなりません。
Sub OpenASPOrCS()
'DESCRIPTION: Open .aspx file if in .cs file, open .cs file if in .aspx file
On Error Resume Next
' Get current doc path
Dim FullName
FullName = LCase(ActiveDocument.FullName)
If FullName = "" Then
MsgBox("Error, not a .cs or asp file!")
Exit Sub
End If
' Get current doc name
Dim DocName
DocName = ActiveDocument.Name
Dim IsCSFile
IsCSFile = False
Dim fn
Dim dn
If (Right(FullName, 3) = ".cs") Then
fn = Left(FullName, Len(FullName) - 3)
dn = Left(DocName, Len(DocName) - 3)
IsCSFile = True
ElseIf ((Right(FullName, 5) = ".aspx") Or (Right(FullName, 5) = ".ascx")) Then
fn = FullName + ".cs"
dn = DocName + ".cs"
Else
MsgBox("Error, not a .cs, or an asp file!")
Exit Sub
End If
Dim doc As EnvDTE.Documents
DTE.ItemOperations.OpenFile(fn)
doc.DTE.ItemOperations.OpenFile(fn)
If Err.Number = 0 Then
Exit Sub
End If
' First check to see if the file is already open and activate it
For Each doc In DTE.Documents()
If doc.Name = dn Then
doc.Active = True
Exit Sub
End If
Next
End Sub