• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy from Excel and Paste On Application

Anwaar

New Member
Hi,


I am trying to have a macro which when clicked upon, should copy the text from a specific cell (Eg.Al) and paste in on a specific tab (Eg. Email Address) in an internal application. I am a novice and do not have much knowledge of VBA, so any help for creating such a macro would be appreciated.


Regards,

AK
 
Hi, Anwaar!


It seems as if everybody missed this topic, so first of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the three first green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about your question...


If you haven't performed yet the search herein, try going to the topmost right zone of this page (Custom Search), type the keywords used in Tags field when creating the topic or other proper words and press Search button. You'd retrieve many links from this website, maybe you find useful information and even the solution. If not please advise so as people who read it could get back to you as soon as possible.


Specifically it's hard to give you a bullet-proof answer since you didn't tell us which is the internal application you're talking about. What you can do with the following code is to put a group of cells (in this case the selected ones) into the clipboard, so the first thing you should do is try if pasting with Ctrl-V does the job. If not consider elaborating a bit more your explanation including details of the so called internal application, data to be pasted into and every detail as possible.


Code:

-----

[pre]
Code:
Option Explicit

Sub CopyRangeToClipboard()
    ' constants
    Const ksRowSeparator = vbCrLf
    Const ksColumnSeparator = ","
    ' declarations
    Dim I As Long, J As Long, A As String, rng As Range
    ' start
    Set rng = Selection.Cells
    A = ""
    ' process
    '  build string
    With rng
        For I = 1 To .Rows.Count
            For J = 1 To .Columns.Count
                A = A & .Cells(I, J).Value
                If J <> .Columns.Count Then A = A & ksColumnSeparator
            Next J
            If I <> .Rows.Count Then A = A & ksRowSeparator
        Next I
    End With
    '  copy to clipboard
    Dim DataObj As New MSForms.DataObject
    DataObj.SetText A
    DataObj.PutInClipboard
    Set DataObj = Nothing
    ' end
    Set rng = Nothing
End Sub
[/pre]
-----


Just advise if any issue.


Regards!
 
Hi SirJB7,


Before using your code, OP will have to set reference in VBE via:

Tools | References | Microsoft Forms 2.0 Object Library


We had discussed this here:

http://chandoo.org/forums/topic/concatenate-two-text-in-vba
 
@shrivallabha!

You're right, I missed it since I pasted the code instead of uploading the sample workbook. Thanks.

Regards!
 
Good Evening SirJB7,


First of all I would like to thank you for your willingness to assist me. The guesture is much appreciated. Also, I would definitely keep your recommendation in mind and search the forum the next time, I am seeking a resolution.


As asked for, I have included the details on the attached file.


https://skydrive.live.com/#cid=94DF0757361DBDD5&id=94DF0757361DBDD5%21103


Please let me know if you need any other details.


Thanks again for your help.


Best Wishes

Anwaar
 
Hi, Anwaar!

After reading your recently post, I'm afraid the code posted by me one month ago wouldn't work.

I have a few doubts:

a) you have a workbook with 2 dropdown boxes (one for SHO values and another for CRA values)

b) when you click on one of those text boxes you want to copy text in A1 or A2 cells to a field named "SR Title" of a non-Excel application called "Siebell Call Center"

c) this non-Excel application is a standalone application or an internet -browser based- application?

d) you have code obtained from "This person" or whom might ever be that does actually something, what is this something?, as I don't have the Siebel Call Center application

Regards!
 
Hi SirJB7,


Thanks for your reply.


A)Well, I had 2 text boxes, just to give you an idea of what I actually wanted. However, if we are able to crack this, then there will be around 20 such text boxes for SHO, CRA, Document Request, Tax etc.

B) Absolutely correct.

C) This is an IE based application and is only available on the intranet, else I would have shown it to you... But yes it is a internet -browser based- application

D) I was browsing thru various forums and articles and found this thread " Macro to copy to application" http://www.excelbanter.com/showthread.php?t=319421. So, I tried to use it by changing the active app name in the code to Siebel Call Center and it worked to a certain extent. It copied the text in the cell and moved to the intended application. However, it did not get to the right tab " SR Title " neither did it give me an option to paste.


Please let me know if you need any other information.


Regards,

Anwaar
 
Hi SirJB7,


I am not sure, if I was able to answer to your questions precisely and articulate my requirement properly. Please write back in case you need any more details.


Regards,

Anwaar Khan
 
Hi, Anwaar!


Sorry but I missed your previous post with your reply, that's why I didn't answer you.


I'm afraid I can't realize what's going wrong with your workbook and the copied code, since it seems to work fine. So let us do the job reversely.

- you have a workbook with the 2 combo boxes and the posted code, do you have any other VBA code in it? would you post a sample file with the full worksheet structure and the VBA related?

- would you post samples of the full window of your intranet application?


Without having access to the related application it's difficult to analyze the problem.


Regards!
 
Back
Top