Solved

Capture computer IP address as a string in VBA for Excel.  How?

Posted on 2007-04-04
5
1,692 Views
Last Modified: 2009-05-19
I am trying to capture the computer IP address as a string in VBA code in Excel.  How can I do this?
0
Comment
Question by:ohmetw
  • 3
5 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18849865
Code to find IP address: http://puremis.net/excel/code/079.shtml
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 18849867
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18849869
0
 
LVL 3

Expert Comment

by:bobpsmith
ID: 18850434
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("%comspec% /c ipconfig")

do while oExec.stdOut.AtEndOfStream <>true
      strLine=oExec.stdOut.Readline

      if instr(strLine,"Address")>0 then
            'found
            strIP=StrLine
            exit do
      end if
loop

msgbox mid(strIP,(instr(strIP,":")+2))

ref: http://www.myvbs.info/scripts.aspx?scriptname=IPAddress.vbs
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18853757
Thanx.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question