Solved

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

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

772 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