自己湊出方法了
雖然很遜
但是湊合著用
雖然這東西沒什麼人
有路過可以幫我修改一下 也是感謝啦
- Sub Run()
- Dim arr, s$, i&, j&, n%
- Open ThisWorkbook.Path & "" & "sysmon.txt" For Output As #1
- arr = Range("A1").CurrentRegion
- For i = 2 To UBound(arr)
- 'MsgBox arr(i, 3)
- If arr(i, 3) = "ping" Then
- Print #1, vbCrLf & vbCrLf
- Print #1, "object " & arr(i, 1) & " {"
- Print #1, " ip " & """" & arr(i, 2) & """" & ";"
- Print #1, " type " & arr(i, 3) & ";"
- Print #1, " desc " & """" & arr(i, 4) & """" & ";"
- Print #1, " dep " & """" & arr(i, 5) & """" & ";"
- Print #1, " contact " & """" & arr(i, 6) & """" & ";"
- Print #1, " contact_on " & arr(i, 7) & ";"
- Print #1, "};"
- Print #1, vbCrLf & vbCrLf
- 'Close #1
- Else
- If arr(i, 3) = "port" Then
- Print #1, vbCrLf & vbCrLf
- Print #1, "object " & arr(i, 1) & " {"
- Print #1, " ip " & """" & arr(i, 2) & """" & ";"
- Print #1, " type " & arr(i, 3) & ";"
- Print #1, " desc " & """" & arr(i, 4) & """" & ";"
- Print #1, " port " & """" & arr(i, 8) & """" & ";"
- Print #1, " contact " & """" & arr(i, 6) & """" & ";"
- Print #1, " contact_on " & arr(i, 7) & ";"
- Print #1, "};"
- Print #1, vbCrLf & vbCrLf
- Else
- If arr(i, 3) = "www" Then
- Print #1, vbCrLf & vbCrLf
- Print #1, "object " & arr(i, 1) & " {"
- Print #1, " ip " & """" & arr(i, 2) & """" & ";"
- Print #1, " type " & arr(i, 3) & ";"
- Print #1, " url " & """" & arr(i, 9) & """" & ";"
- Print #1, " urltext " & """" & arr(i, 10) & """" & ";"
- Print #1, " desc " & """" & arr(i, 4) & """" & ";"
- Print #1, " contact " & """" & arr(i, 6) & """" & ";"
- Print #1, " contact_on " & arr(i, 7) & ";"
- Print #1, "};"
- Print #1, vbCrLf & vbCrLf
- Else
- End If
- End If
- End If
- Next
- MsgBox "ok"
- Close #1
- End Sub
复制代码
|