+ Reply to Thread
Results 1 to 3 of 3

Text fiel encrypt and decrypt

  1. #1
    Registered User
    Join Date
    11-13-2003
    Location
    India
    MS-Off Ver
    2007
    Posts
    65

    Text fiel encrypt and decrypt

    I have found code for text file encrypt and decrypt , unfortunately decrypt (command2) dont bring back my text file .
    Pl. help
    Or any body having better but very simple solution for it, I don't want a very critical method for encryption just for file forwarding purpose that other user not able to read it.


    Private Sub Command1_Click()
    Dim ff As Integer
    Dim i As Long, n As Long
    Dim b As Byte, c As Byte

    ff = FreeFile
    Open App.Path & "\REFERENCE_DATA.dat" For Binary As #ff
    n = LOF(ff)
    For i = 1 To n
    Get #ff, i, b
    c = b Xor &hff
    Put #ff, i, c
    Next i
    Close #ff

    MsgBox "file encrypted"

    End Sub

    Private Sub Command2_Click()
    Dim ff As Integer
    Dim i As Long, n As Long
    Dim b As Byte, c As Byte

    ff = FreeFile
    Open App.Path & "\REFERENCE_DATA.dat" For Binary As #ff
    n = LOF(ff)
    For i = 1 To n
    Get #ff, i, b
    c = b Xor &hff
    Put #ff, i, c
    Next i
    Close #ff

    MsgBox "file decrypted"

    End Sub
    mast

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Text fiel encrypt and decrypt

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-13-2003
    Location
    India
    MS-Off Ver
    2007
    Posts
    65

    Re: Text fiel encrypt and decrypt

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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