Tema: Re: In Excel IP address
Autorius: ab
Data: 2010-02-26 22:13:45
MinVodai said the following on 2010.02.26 18:14:
> va va... cia ir susiduriu su sia problema :(
> aciu, Raimis, buvau jau sita rades, bet Vista keikiasi prie sito :(
> esme tame, kad is tinklo excel failu naudojasi keli vartotojai, tai kaip ir
> sumasciau, kad pagal
> IP adresus uz hidinsiu stulpus kuriu nereikia matyti vieniem arba kitiem
> darbuotojam...
> bet kur xp ir 2003 viskas OK, kur Vista ir 2007 keikiasi :S
> Debugas rodo prie eilutes "Set fil = FSO.GetFile(TempFil)"

gal tiesiog Vistoje paprasčiausiai neleidžia sukurti c:\myip.txt failo. 
Jeigu pakeitus į c:\temp\myip.txt?


>
> to paties failo du vartotojai neatsidare, pats bandziau!
>
> gal turit ideju?  gal su PC vardais??
>   tik prasau be komentu apie pirmykste bendruomene su bendrais duomenimis is
> excel :)
> taip reikia!
> ACIU
>
> "Raimis"<somebody@nomail.com>  wrote in message
> news:hm89k3$24e$1@trimpas.omnitel.net...
>> vidini tai per VBA:
>>
>> Sub IPtest()
>>     Dim wsh As Object
>>     Dim RegEx As Object, RegM As Object
>>     Dim FSO As Object, fil As Object
>>     Dim ts As Object, txtAll As String, TempFil As String
>>     Set wsh = CreateObject("WScript.Shell")
>>     Set FSO = CreateObject("Scripting.FileSystemObject")
>>     Set RegEx = CreateObject("vbscript.regexp")
>>     TempFil = "C:\myip.txt"
>>      ' Save ipconfig info to temporary file
>>     wsh.Run "%comspec% /c ipconfig>  "&  TempFil, 0, True
>>     With RegEx
>>         .Pattern = "(\d{1,3}\.){3}\d{1,3}"
>>         .Global = False
>>     End With
>>     Set fil = FSO.GetFile(TempFil)
>>      ' Access temporary file
>>     Set ts = fil.OpenAsTextStream(1)
>>     txtAll = ts.ReadAll
>>     Set RegM = RegEx.Execute(txtAll)
>>      ' Return IP address to Activesheet cell A1 by parsing text
>>     ActiveSheet.Range("A1").Value = RegM(0)
>>     ActiveSheet.Range("A1").EntireColumn.AutoFit
>>     ts.Close
>>      ' Remove temp file
>>     Kill TempFil
>>
>>     Set ts = Nothing
>>     Set wsh = Nothing
>>     Set fil = Nothing
>>     Set FSO = Nothing
>>     Set RegM = Nothing
>>     Set RegEx = Nothing
>> End Sub
>> "MinVodai"<minvodai@gmail.com>  wrote in message
>> news:hm87p8$ut4$1@trimpas.omnitel.net...
>>> Kokia funkcija ar komanda gali i cele ikelti  IP adresiuka?
>>> zinoma butu sauniausia, kad isorini ikeltu.
>>>
>>> ACIU
>>>