Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-04-04
5
Medium Priority
?
1,697 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 18849865
Code to find IP address: http://puremis.net/excel/code/079.shtml
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

670 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