Solved

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

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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 …
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

896 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

17 Experts available now in Live!

Get 1:1 Help Now