PureBluff
10-10-2013, 01:40 PM
Hi all, I'm trying to simplify the way I do a process at work, currently I have it slipstreamed ok but still all too manual for my liking. I currently copy data 26 times per load and manually type a value in 26 times - (the destination has a delay around this area so copy/paste gets caught by the delay and doesn't paste at the correct time)
So, what I'm trying to do (Although I appreciate it's maybe not achievable, or, I'm going the wrong way about it, which brings me here) -
n.b I'm using wordpad as an example.
Sub switchtest()
Worksheets("Sheet1").Range("A2:E2").Copy
Dim notepad, ReturnValue
AppActivate "notepad" 'Activate notepad
Application.SendKeys ("%e")
Application.SendKeys ("p")
End Sub
Now, this works great - notepad is switched to and the data pasted.
I then wish to 'switch' back to Excel in the same macro, copy cell "F2" and switch back to 'notepad' and paste using .SendKeys again. {This is where the delay is occuring within the destination, hence why I wish to copy it in 2 parts}
However, being the complete noob with zero VBA knowledge except google and a couple of userforms, I'm not sure how I should go about linking to two routines, these two routines will be applied 26 times in turn;
i.e.
A2:E2
F2
A3:E3
F3
A4:E4
F4
If that helps in choosing any particular set of code better suited. Obviously I wish to get the 2 sections for row 2 nailed before moving on (run before you can walk!)
Any advise or insight appreciated.
Regards
So, what I'm trying to do (Although I appreciate it's maybe not achievable, or, I'm going the wrong way about it, which brings me here) -
n.b I'm using wordpad as an example.
Sub switchtest()
Worksheets("Sheet1").Range("A2:E2").Copy
Dim notepad, ReturnValue
AppActivate "notepad" 'Activate notepad
Application.SendKeys ("%e")
Application.SendKeys ("p")
End Sub
Now, this works great - notepad is switched to and the data pasted.
I then wish to 'switch' back to Excel in the same macro, copy cell "F2" and switch back to 'notepad' and paste using .SendKeys again. {This is where the delay is occuring within the destination, hence why I wish to copy it in 2 parts}
However, being the complete noob with zero VBA knowledge except google and a couple of userforms, I'm not sure how I should go about linking to two routines, these two routines will be applied 26 times in turn;
i.e.
A2:E2
F2
A3:E3
F3
A4:E4
F4
If that helps in choosing any particular set of code better suited. Obviously I wish to get the 2 sections for row 2 nailed before moving on (run before you can walk!)
Any advise or insight appreciated.
Regards