Results 1 to 4 of 4

Thread: MS excel url encode

  1. #1
    Join Date
    Jan 2009
    Posts
    40

    MS excel url encode

    Hello everyone,
    There is a function called url encode in MS excel 2003. Is it also there in MS excel 2007? Can anyone tell me how can i use it?

    All suggestions are welcome.

  2. #2
    Join Date
    Apr 2008
    Posts
    4,642

    Re: MS excel url encode

    Try the Excel VBA and Excel UserForms Training 1 tool for guideline to use url encode in excel. You can access it from directly from excel tools menu by clicking on the new menu item. It is visual basic editor tool features Objects and Properties, Excel Objects , Object Hierarchy, Application, Workbook, Worksheet, Range, CommandBars, Variables and Constants, Data types, Variable Levels, Declaring Variables, Constants, Loops, Types of Loops, Loop Pitfalls, Effective Decision Making, If/And/Or, Select Case, Dates and Times, Workbook and Worksheet Events, Debugging and Error Handling, Prevention.

  3. #3
    Join Date
    May 2008
    Posts
    4,345

    Re: MS excel url encode

    Try the following URL Encoder and Decoder for VB:
    Public Function URLEncode(StringToEncode As String, Optional _
    UsePlusRatherThanHexForSpace As Boolean = False) As String

    Dim TempAns As String
    Dim CurChr As Integer
    CurChr = 1
    Do Until CurChr - 1 = Len(StringToEncode)
    Select Case Asc(Mid(StringToEncode, CurChr, 1))
    Case 48 To 57, 65 To 90, 97 To 122
    TempAns = TempAns & Mid(StringToEncode, CurChr, 1)
    Case 32
    If UsePlusRatherThanHexForSpace = True Then
    TempAns = TempAns & "+"
    Else
    TempAns = TempAns & "%" & Hex(32)
    End If
    Case Else
    TempAns = TempAns & "%" & _
    Format(Hex(Asc(Mid(StringToEncode, _
    CurChr, 1))), "00")
    End Select

    CurChr = CurChr + 1
    Loop

    URLEncode = TempAns
    End Function


    Public Function URLDecode(StringToDecode As String) As String

    Dim TempAns As String
    Dim CurChr As Integer

    CurChr = 1

    Do Until CurChr - 1 = Len(StringToDecode)
    Select Case Mid(StringToDecode, CurChr, 1)
    Case "+"
    TempAns = TempAns & " "
    Case "%"
    TempAns = TempAns & Chr(Val("&h" & _
    Mid(StringToDecode, CurChr + 1, 2)))
    CurChr = CurChr + 2
    Case Else
    TempAns = TempAns & Mid(StringToDecode, CurChr, 1)
    End Select

    CurChr = CurChr + 1
    Loop

    URLDecode = TempAns
    End Function


    ' URLDecode function in Perl for reference
    ' both VB and Perl versions must return same
    '
    ' sub urldecode{
    ' local($val)=@_;
    ' $val=~s/\+/ /g;
    ' $val=~s/%([0-9A-H]{2})/pack('C',hex($1))/ge;
    ' return $val;
    ' }
    Source: freevbcode.com

  4. #4
    Join Date
    May 2008
    Posts
    4,570

    Re: MS excel url encode

    You can get help with the online module on Microsoft office 2007. There are pretty good explanations on how to use tools and features of MS Excel 2007. Check the following link for getting started: http://office.microsoft.com/en-us/ge...938921033.aspx

Similar Threads

  1. How to encode URL in JavaScript and decode in PHP?
    By Linoo in forum Software Development
    Replies: 4
    Last Post: 25-02-2010, 10:24 PM
  2. How to encode or decode variables in PHP
    By Badrunath in forum Software Development
    Replies: 2
    Last Post: 26-08-2009, 11:19 PM
  3. How to encode dvd to mp4
    By Manthan in forum Windows Software
    Replies: 3
    Last Post: 21-08-2009, 12:45 PM
  4. Encode all videos to 1080p HD
    By dan-dan in forum Hardware Peripherals
    Replies: 3
    Last Post: 18-08-2009, 11:20 PM
  5. PC crashes when I encode DVD
    By Blazej in forum Hardware Peripherals
    Replies: 4
    Last Post: 24-04-2009, 09:05 PM

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
  •  
Page generated in 1,711,689,342.16328 seconds with 17 queries