[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

checking for vpn correctly in vba

Posted on 2014-01-13
2
Medium Priority
?
1,561 Views
Last Modified: 2014-01-15
excel 2010 vba:


'Please check description of your VPN Connection by running command "ipconfig /all" on command-line.

    
    ' NO CELL CARD...wireless at home...vpn description
    If (InStr(objItem.Description, "AnyConnect")) Then
     IsVPNConnected = objItem.IPEnabled
    End If

  ''Branch Wireless  works
   If (InStr(objItem.Description, "Centrino")) Then
     IsVPNConnected = objItem.IPEnabled
    End If


  'Branch Ethernet hardwired works
   If (InStr(objItem.Description, "Gigabit")) Then
     IsVPNConnected = objItem.IPEnabled
    End If
  

   If (IsVPNConnected) Then
    IsVPNConnected = MsgBox("I am Connected to VPN.")
    GoTo LINE20
    
    
   Else
    IsVPNConnected = MsgBox("I am Not Connected to VPN.")
   GoTo LINE10
   
   End If

Open in new window




Just lookin to clean this if.then... code up.

Is there a better way to check for each connection ?

if any of these are true then...
 
    ' NO CELL CARD...wireless at home...vpn description
    If (InStr(objItem.Description, "AnyConnect")) Then
     IsVPNConnected = objItem.IPEnabled
    End If

  ''Branch Wireless  works
   If (InStr(objItem.Description, "Centrino")) Then
     IsVPNConnected = objItem.IPEnabled
    End If


  'Branch Ethernet hardwired works
   If (InStr(objItem.Description, "Gigabit")) Then
     IsVPNConnected = objItem.IPEnabled
    End If


 If (IsVPNConnected) Then
    IsVPNConnected = MsgBox("I am Connected to VPN.")
    GoTo LINE20
   
   
   Else
    IsVPNConnected = MsgBox("I am Not Connected to VPN.")
   GoTo LINE10

Thanks

fordraiders
0
Comment
Question by:fordraiders
[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
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 39777700
Here is one

    If (InStr(objItem.Description, "AnyConnect")) Or _
        (InStr(objItem.Description, "Centrino")) Or _
        (InStr(objItem.Description, "Gigabit")) Then
     IsVPNConnected = objItem.IPEnabled
    End If
 

   If (IsVPNConnected) Then
    IsVPNConnected = MsgBox("I am Connected to VPN.")
    GoTo LINE20
   
   
   Else
    IsVPNConnected = MsgBox("I am Not Connected to VPN.")
   GoTo LINE10
   
   End If
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39783068
Thanks very much
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

656 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