複数ある場合は、foreachでまわして探す。
$localHostName = [System.Net.Dns]::GetHostName()
$localIP = [System.Net.Dns]::GetHostByName( $localHostName )
$localIP.AddressList[0].ToString()
Sub SpaseSeparatedValues()
Dim i, j As Integer
Dim fileName As String
fileName = ActiveWorkbook.Path & "\" & ActiveSheet.Name & ".txt"
Dim scope As String
scope = InputBox("スペース区切りで出力したい範囲をしていしてください。", "SpaseSeparatedValues")
Dim data As Variant
data = Range(scope)
Dim fileNo As Integer
fileNo = FreeFile()
Open fileName For Output As #fileNo
Dim printLine As String
For i = 1 To UBound(data)
printLine = ""
For j = 1 To UBound(data, 2)
printLine = printLine & data(i, j) & Space(Int(Cells(i, j).ColumnWidth) - Len(data(i, j)))
Next
Print #fileNo, printLine
Next
Close #fileNo
End Sub
Copyright © 2008 風待ち | Design by Smashing Wordpress Themes - Blogger template by Zona Chrome