Copy from excel and paste into other application

Hawk1979

New Member
Joined
Apr 11, 2004
Messages
14
Hi, all:


I have a problem

i have an account application , where i have to paste some informacion copied from excel . i have a code its do ..

sub mycode()
Range("C4:C14").Select
Selection.Copy
Application.WindowState = xlMinimized
end sub


1.-copy a range from excel
2.-minize excel application (Excel Window)
3.-in the current window(accountin program because excel was minized)
i paste de information with Ctrl + V (manually) and i press enter
(Manually).
4.-After, i return to excel and run "Mymacro" .. and follow doing again the firts steps. and so on


my problem is i have to do it like 200 times , and i would like to know if it could do with a code something like this:

sub Mynewmacro()
dim cont=0
do
Range("C4:C14").Select
Selection.Copy ' copy de range that i want
Application.WindowState = xlMinimized ' minize excel
with activeApplication ' account program
.paste ' paste the informacion in the blanks
end with
Press enter ' i dont know the code for press enter to accept the data
Application.WindowState = xlMinimized ' minize Acount program

cont=cont+1
loop until cont=200
end sub


however.... regarts MVP`S
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Have you tried to link to the accounting program?


this is a method of linking and automating word.

Selection.Copy ' from excel

Dim mylink As Object
Set mylink = GetObject(, "word.application") 'find running instance of word
mylink.Visible = True ' makesure the instance is visiable
mylink.Selection.Paste ' paste copied value to word
'

You might also try the sendkeys command....see help sendkeys

SendKeys Statement Example
This example uses the Shell function to run the Calculator application included with Microsoft Windows. It uses the SendKeys statement to send keystrokes to add some numbers, and then quit the Calculator. (To see the example, paste it into a procedure, then run the procedure. Because AppActivate changes the focus to the Calculator application, you can't single step through the code.). On the Macintosh, use a Macintosh application that accepts keyboard input instead of the Windows Calculator.

Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I & "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
 
Upvote 0
now i am working with this code

Sub Mymacro()
Application.ScreenUpdating = False
Do
Selection.Copy ' from excel
Application.WindowState = xlMinimized
Dim mylink As Object
Set mylink = GetObject(, "word.application") 'find running instance of word
'AppActivate mylik ' i cant run with this code
mylink.Visible = True ' makesure the instance is visiable
mylink.Selection.Paste ' paste copied value to word
cont = cont + 1
SendKeys "{Enter}", True
Application.WindowState = xlNormal
Loop Until cont = 5
Application.CutCopyMode = False
End Sub



i have the code of minizeexcel and maximize because the enter , was not working , also i was traing with this code

AppActivate mylik ' i cant run with this code

but i was only error




what do you comment respect



Thanks MVP
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,699
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top