+ Reply to Thread
Results 1 to 3 of 3

Copy a TXT File's Contents to Clipboard using VBA

  1. #1
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Copy a TXT File's Contents to Clipboard using VBA

    Hey all,
    Access scripting question here.

    But first a little background:
    We have a rather robust Access DB now that multiple users logged into it at the same time. To help control who see's different tabs and who can click on different buttons and what not, we have an Access Control module setup. It lists out different roles and what those roles have access to all the way down to individual buttons. I wrote up a cool excel file that helps me adjust those rules graphically. When im happy with the rules, i hit a button and those rules are exported out to a TXT file ready to be copied to the Access module. Currently, the module has 11,044 lines of code in it.

    On to my question:
    I am having the hardest time finding examples of this. Basically i'm looking for a Access script that once executed it will open a browse window allowing me to browse and select a TXT file. It will then copy the contents of that target file to the windows clipboard.

    My thoughts then would be to manually open the module, select all text, delete it, paste the copied contents into the module, and then save the file. If this part could be done using VBA that would be wonderful but im not aware VBA being able to edit the contents of a module.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Copy a TXT File's Contents to Clipboard using VBA

    What is in the text file? You can copy it to a clipboard, but if its data, just bring it into an access table,(not the clipboard)
    then you can do whatever you need with the data.

    in a button click event , this code will ask user to select a file, (and then hopefully import it)

    usage:
    txtBox = UserPick1File("c:\folder\")

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Copy a TXT File's Contents to Clipboard using VBA

    The text file has all of my Access Control VB code in it. It is nothing that i can put into a table.

+ 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] Need Copy file name and contents of that file in a specified path
    By punna111 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-12-2014, 10:37 AM
  2. Copy a file to the clipboard
    By tomlancaster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2010, 08:53 AM
  3. Clear sheet contents but retain Clipboard contents
    By nebb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2007, 01:42 PM
  4. copy and paste and clipboard contents message
    By dr chuck in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2006, 11:35 AM
  5. [SOLVED] Keep contents in clipboard
    By Kenny in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-20-2005, 04:05 PM
  6. Copy outside Clipboard contents (html page) to a cell in Excel
    By sifar in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-12-2005, 07:05 PM
  7. [SOLVED] Copy outside Clipboard contents (html page) to a cell in Excel
    By sifar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2005, 11: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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1