Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Copy Text To Clipboard

Posted on 2004-09-17
8
Medium Priority
?
408 Views
Last Modified: 2007-12-19
I need to copy data from a Text Box to the Clipboard I know about
     Clipboard.SetText TextValue
However I need to do this in Access VBA and do not want to use a DLL or OCX Because I need this to be accessible to a lot of users on a shared drive who may or may not have the dll
0
Comment
Question by:davidtrina
  • 3
  • 3
  • 2
8 Comments
 
LVL 13

Accepted Solution

by:
Michael_D earned 140 total points
ID: 12087771
Try :

Application.RunCommand acCmdCopy
Application.RunCommand acCmdPaste


Hope it helps.
0
 
LVL 3

Expert Comment

by:aParser
ID: 12087784
You might look at PAQ Q_20132577.html

There is code there to use the SendMessage API to copy selected text to the clipboard.  I don't think it allows you to send text without selecting it first.  The PAQ commenters also assert that there is no native way to access the clipboard inside VBA.

I also came across the Forms Library in a Google search. http://www.cpearson.com/excel/clipboar.htm

However this makes reference to a DLL.  While it should come with VBA, I didn't find it on my machine.  Also, Microsoft has a KB on it that basically says that the DLL is not freely redistributable; you must own a (Microsoft) product that installs it.  That may be tru in your environment and be what you need.

http://support.microsoft.com/default.aspx?kbid=224305

Hope this helps.
0
 
LVL 3

Expert Comment

by:aParser
ID: 12087794
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12087944
Just to give a more complete answer to Michael_Ds submission, you need to select the text in the textbox before using the copy command:

    Private Sub Command2_click()
        Text0.SetFocus
        Text0.Text = fileContents
        Text0.SelStart = 0
        Text0.SelLength = Len(Text0.Text)
        DoCmd.RunCommand acCmdCopy
    End Sub

Regards,

Idle_Mind
0
 
LVL 13

Expert Comment

by:Michael_D
ID: 12089491
Idle_Mind: You are always give "complete answer" :)
But I think that experts should give only an idea how to do something. Sometime it helps better then "complete answer".  
If it dosent help then try to help more.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12089583
You are going to get 50/50 split on whether a "Complete Answer" is better than an "outline answer" or a vague "use this command answer".

It really all depends on the author of the question.   Some can fill in the gaps...others can't.  If an author specifically says, "give me an idea of where to look and I can figure out the rest" then I won't give a "complete answer".  Otherwise, I give as detailed an answer as I can so that the author can choose how much of that information they need or don't need.  But by giving the author a working solution, they can usually see how to apply it their particular problem.

I did give your "correct answer" credit.  If davidtrina is experienced enough to know how to implement the command

    DoCmd.RunCommand acCmdCopy

without further assitance, then he/she will ignore my answer and accept yours since I "stated the obvious" and they already knew how to do it.  Just because the author didn't figure out how to solve the problem by themself doesn't mean they haven't learned anything.

Regards,

Idle_Mind
0
 
LVL 13

Expert Comment

by:Michael_D
ID: 12089766
You dont understand me correct! I dont care about points, I dont need them. You are absolutely right: all depends on the author of question. But it difficult to ignore full answer when it given. and there no more "brain" activity needed. In this particular question author said that he knows how to use  "Clipboard.SetText TextValue" . He also knows that VBA doesn't have Clippboard Object. By my opinion this user able to figure out by himself how to use Application.RunCommand if he knows that this command exists. Correct me if i am wrong.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12089857
>> But it difficult to ignore full answer when it given.

So give full answers!

If people didn't want them, they would accept "brain teaser" answers more often than "complete answers".

...but as you stated yourself, this isn't the case.  Most authors clearly state when they don't want detailed answers, and would like to see a generalized discussion instead.

If you want to increase peoples "brain activity" then try posting here:
http://www.experts-exchange.com/Miscellaneous/Puzzles_Riddles/

/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|

davidtrina,

If you end up using the DoCmd.RunCommand acCmdCopy approach, please accept Michael_Ds submission and not mine.

/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|

Regards,
   =)
Idle_Mind
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

824 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