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

x
?
Solved

Opposite of Hex function?

Posted on 1998-02-01
1
Medium Priority
?
499 Views
Last Modified: 2012-08-14
Hello all!
I am wondering if there is any opposite of the Hex function?
Ex. Hex(255) returns FF.
Then should ThatFunction(FF) return 255!
0
Comment
Question by:martinag
[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
1 Comment
 
LVL 8

Accepted Solution

by:
mrmick earned 400 total points
ID: 1454797
Function HexStringToDecimal(Hex As String) As Long

   Dim strIn$, i&, j&, k&, c$
   strIn = Trim$(Hex)
   If Len(strIn) > 8 Then
      'Overflow
      Exit Function
   End If
   For i = Len(strIn) To 1 Step -1
      c = UCase(Mid$(Hex, i, 1))
      Select Case c
         Case "0" To "9"
            k = k + CLng(c) * 16 ^ j
         Case "A" To "F"
            k = k + (Asc(c) - 55) * 16 ^ j
         Case Else
            'Invalid character Error
            Exit Function
      End Select
      j = j + 1
   Next
   HexStringToDecimal = k

End Function

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

705 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