Data from another window

  • Thread starter Thread starter johnfli
  • Start date Start date
J

johnfli

Ok, here is a question for you super smart people.
I have one program that has an alpha-numeric string of data in once place.
My users copy this data and past it into a cell, then go back to the first
program, run another query, copy and paste that alpha-numeric number and
past it into the next cell etc, etc, etc all day long.

Is there a way I can write a macro (or you guys write it for me) to where
after I run a query on my first program, I go to excel, run teh macro and
have it read teh data off of my first program and paste it in the currently
selected cell in Excel??



That would be awesome if that could happen.

Thanks!!
 
Hi,

It might be possible depending on what form and file
type the data to be copied is in. Is it just a text file?
Can you elaborate a bit? maybe a small example?

jeff
 
it is data that is being display in another program.
In VB I can get the text I want copied to teh clipboard, but when I try
tocopy the code into an Excel Macro, it doesn't like the command
Clipboard.GetText
 
Hi,

It took a while for me to catch on, but it's really
pretty simple. You have to add a userform, and on it
just add a command button and a textbox. when you
activate the userform
(with Userform1.show), click on the commandbutton
(commandbutton1) and this code will transfer your
text from the clipboard (thru the userform's dataobject)
to active sheet Cell A1.

try it and let me know how it works for you.

jeff

Dim MyData As DataObject

Private Sub UserForm_Initialize()
Set MyData = New DataObject
End Sub

Private Sub CommandButton1_Click()
MyData.GetFromClipboard
TextBox1.Text = MyData.GetText(1)
ActiveSheet.Range("A1") = TextBox1.Text
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top