I am attempting to take the contents of an excel file or a csv file and paste the contents of specific cells into the fields of another application. Does anyone have any advice as to how I could do this?
Any help is greatly appreciated.
Reese Williams
[email protected]
Can MScheduler paste Excel cell contents to another app?
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Here is an outline of one way to do it. untested, no real code, just a skeleton.
Someone may also be able to show you how to use DDE to get info from Excel. Don't know if you can use DDE with Application 2.Open Excel
Set Focus> Excel window
Goto> Cell 1
CTL-C (to copy cell1 to clipboard)
GetClipBoard>Value1 (to assign clipboard value to variable)
Do previous 3 lines above for all 8 cells, can use a counter and subroutine and do above 8 times. Change numbers for 1-8 as needed.
Close Excel
Open Application 2
Set Focus> For Application 2
Goto> location for Value1
Send Text>%Value1%
Do previous 2 lines for all 8 values, can use a counter and subroutine and do above 8 times. Change numbers for 1-8 as needed.
Close Application 2.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Or, a more seamless way to do this would be to use VBScript and ADO to read in the CSV file line by line and paste the data into the other app. This removes the need to open Excel and automate it.
As Bob says you can also use DDE to grab data from Excel. There should be examples at http://www.mjtnet.com/scripts.hts and also here on this forum - use the search facility.
As Bob says you can also use DDE to grab data from Excel. There should be examples at http://www.mjtnet.com/scripts.hts and also here on this forum - use the search facility.
MJT Net Support
[email protected]
[email protected]