Data from Excel to drop down modal

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
mduffin
Newbie
Posts: 19
Joined: Fri Nov 12, 2010 4:16 pm

Data from Excel to drop down modal

Post by mduffin » Tue Sep 03, 2013 5:19 pm

Hi, How can I load a value from a selected cell in excel (numbers), then have that data "type" out on a web form?

There are three separate date of birth fields (day/month/year) that are drop down mouse click boxes on a web page. If you have that field selected and you type the number fast enough, it will select that from the drop down instead of having to use the drop down button and scrolling..

I have the data in an excel sheet and the day, month and year are all in separate cells..
Ideally, the web page would be text fields that could be copy/pasted into.. but it's not.

So, I need to take the data from the cell in excel, then switch over to the webpage and have the macro type the numbers.. I was using the Sendtext command and if I just put in a number, that command works in that drop down field... So I know the program can do what I want it to do.. but how do I get the data from excel and have the macro look at it as numbers to be typed instead of just data from a copy function?

I hope I'm making sense, and thanks for your time!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Tue Sep 03, 2013 10:25 pm

I just replied to your ticket about this, so you should have just received an answer. I'll paste it here also, to help others. As you have already figured out the entering of the data to the webpage, this deals with getting the data from Excel in the first place.

------------
That's where functions such as XLGetCell come in.

Code: Select all

XLOpen>%USERDOCUMENTS_DIR%\mybook.xls,1,xlBook

XLGetCell>xlBook,Sheet1,2,2,strValue
The value in that cell would be in the variable strValue

http://www.mjtnet.com/manual/index.html?xlgetcell.htm
Yes, we have a Custom Scripting Service. Message me or go here

mduffin
Newbie
Posts: 19
Joined: Fri Nov 12, 2010 4:16 pm

Post by mduffin » Wed Sep 04, 2013 12:40 pm

I have the excel sheet open and am using copy and paste for the fields I can use that for..
Is there a way to get the macro to get the cell data from whatever cell I happen to have selected rather than specifying a specific cell in the code?

Another thought I had while searching through the forums is.. I put the data into excel just because it's easier to separate the data into different fields and arrow around for copy/paste.. but If I kept the data in a txt/csv file.. would that be any easier to deal with?

mduffin
Newbie
Posts: 19
Joined: Fri Nov 12, 2010 4:16 pm

Post by mduffin » Wed Sep 04, 2013 6:55 pm

oh my god it works!!!
Thanks so much for your help!
now I just need to figure out how to get it to do 10 in a row.
I think it has to do with the r=1 then r=1+1..
I'm not sure how that works yet.. or if you can use it to count down the rows in a spreadsheet, we'll see..

Thanks again

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1380
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Wed Sep 04, 2013 10:35 pm

My pleasure. Looping is equally as easy. The snippet below will read B1, B2, B3, ....... B10 simply by looping until row=10

Try this :

Code: Select all

XLOpen>%USERDOCUMENTS_DIR%\mybook.xls,1,xlBook


let>row=0
repeat>row

let>row=row+1
XLGetCell>xlBook,Sheet1,%row%,2,strValue
messagemodal>strValue
  
Until>row,10


Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts