Solved

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

Posted on 2007-04-04
5
1,686 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now