+ Reply to Thread
Results 1 to 26 of 26

vb code to get vpn and ip address

  1. #1
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    vb code to get vpn and ip address

    Hi, I'd like to know if there's a simple code to get the vpn and ip address of a computer or where internet connection is connected. I already have a code for the username and computer.

    I'm missing data for vpn and ip address. Just a simple msgbox would be a big help.

    Thanks.

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,677

    Re: vb code to get vpn and ip address

    Cross-posted at http://www.mrexcel.com/forum/excel-q...p-address.html
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    Hi shg,

    I'm sorry - I didn't know. Please accept my apologies. This won't happen again.

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,677

    Re: vb code to get vpn and ip address

    It's not forbidden, but it is required that you post a link to each place where you posted the same question, so people don't waste their donated time working on a question that has been answered elsewhere.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    36,029

    Re: vb code to get vpn and ip address

    I can't direct you to another site, so Google: excel vba code to get ip address
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    I already tried googling it. It didn't help.

  7. #7
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    So this is my issue, and here's my code.

    -----------------------
    Please Login or Register  to view this content.
    -----------------------

    The 3 codes are working fine - I'm missing vpn code and ip address for my file. Hopefully someone can help. Thanks.
    Last edited by alansidman; 09-17-2016 at 11:40 PM.

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: vb code to get vpn and ip address

    If you're looking for something simple like Msgbox("IP") or Msgbox("VPN"), I'm afraid you might be out of luck. I searched by doing what Trevor said (prior to his post) and I found that you would need a lot of code to get the VPN and IP. There are several options available through a search.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 365 Win 11 Home 64 Bit
    Posts
    21,338

    Re: vb code to get vpn and ip address

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan


    Have you debugged your code?
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,901

    Re: vb code to get vpn and ip address

    How about this one?
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  11. #11
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    Hi bakerman2, it worked for the ip address! thank you!

    I'm only missing code for vpn or access used to the internet.

  12. #12
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    Hi alansidman, thanks for this - I've read the forum rules now. Apologies for breaking it.

  13. #13
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: vb code to get vpn and ip address

    Access to internet, check this link halfway down the page where it says "VBA code"

    http://www.myengineeringworld.net/20...dress-vba.html

    Alf

  14. #14
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    Hi Alf, it's not available in the link you provided.

    I would need to show (see attached) 'MsgBox ("group.net") after the profile details. I need to get the internet access connection where the user is currently connected.
    Attached Images Attached Images

  15. #15
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    here's the code I have so far. I'm just missing the details for 'group.net' to show as MsgBox

    Please Login or Register  to view this content.

  16. #16
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: vb code to get vpn and ip address

    Sorry, my bad that function would only give you the internet IP address of the PC if and when it was connected to the internet.

    Alf

  17. #17
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    up anybody has code for vpn or internet access connection via excel macro vba?

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,198

    Re: vb code to get vpn and ip address

    What do you mean by "Get the VPN"? It's called what ever you type in when you create the connection - is that what you're looking for? Or the IP address that the VPN is connected to?

  19. #19
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    Sorry - I need the SSID or the internet connection VBA Excel code.

  20. #20
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: vb code to get vpn and ip address

    This command used in the "cmd" window will give you the SSID

    Please Login or Register  to view this content.
    So you could run this calling a .bat file something like

    Please Login or Register  to view this content.
    and then you need to capture the output using a Shell command in order to get it to your excel file, sorry but the last part of expertise is way above my present know-how level.

    So hopefully another forum member has a better idea or knows how to capture output using Shell command.

    Alf

  21. #21
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,901

    Re: vb code to get vpn and ip address

    Had to put script in textfile because impossible to post code involving WScript.Shell directly.
    Maybe 1 of the moderators or guru's can explain me why?
    Attached Files Attached Files

  22. #22
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: vb code to get vpn and ip address

    No did not work after the 6th test, just got the macro lines pasted instead of SSID.

    Very strange.

    Alf

  23. #23
    Registered User
    Join Date
    09-10-2015
    Location
    Luzon
    MS-Off Ver
    MS Office 2013
    Posts
    11

    Re: vb code to get vpn and ip address

    I saw this code in one of the threads in this forum, but it did not define 'GetWirlessName'

    Please Login or Register  to view this content.

  24. #24
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: vb code to get vpn and ip address

    A possible way to get the SSID

    You need a bat file as mentioned earlier and the result from the "cmd" command is piped to a text file, then the text is imported into excel.

    Bat file like this, this is stored in the C:\Temp folder and the piped result from "cmd" is stored in the "SSID.txt" file created by the bat file.

    Please Login or Register  to view this content.
    The macro runs the bat file using the Shell command and then reads the "SSID.txt" to excel range A2

    Please Login or Register  to view this content.
    Alf

  25. #25
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,901

    Re: vb code to get vpn and ip address

    @ Alf

    Managed to squeeze it in a oneliner which works for me 10, 20 , 50 ..... times.
    Again no luck in posting code????????
    Attached Files Attached Files

  26. #26
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,637

    Re: vb code to get vpn and ip address

    Yes that works nicely!

    Piping result to file and reading the file works without a hitch but originally I tried to pipe the filtered result using the "CLIP" to get the result to the windows clip board but that worked very erratically so I probably made some mistake in wring the cod. Still have not given up as I would like to solve this.

    Will not post as the OP got a working solution, yours but for my own amusement I do wish to solve the piping problem.

    Alf
    Last edited by Alf; 09-27-2016 at 08:29 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VB Code to get address
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-29-2016, 02:22 PM
  2. Need more address to be able to trigged from - see code below
    By cagney1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 12:13 PM
  3. Code to search for address via Name
    By lazyengineer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2015, 02:37 PM
  4. How to get a Zip Code from an address
    By Drgre in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-20-2015, 07:17 AM
  5. Need VBA to look up for ZIP code in address column.
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2015, 02:29 PM
  6. Replies: 1
    Last Post: 03-08-2012, 01:57 PM
  7. [SOLVED] How do I put the zip code in the address label?
    By xsell in forum Excel General
    Replies: 1
    Last Post: 12-01-2005, 11:35 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1