Posts: 128
Threads: 48
Joined: Jan 2007
Hello,
I'm looking for hel with something... what i want is a function that selects a row in excel (or gets the data from the row selected) gets the data so it can be used in the macro. When i click on a button, the next row needs to be selected and the data has to be copied... and so on.
Can somebody help me with this? i dont have a clue where to start !
any help is welcome !
Thanks in advance...
Freggel
Posts: 1,000
Threads: 253
Joined: Feb 2008
Apparently this doesn't work in the QM Beta 2.3.0.1 yet. I'm sure Gint. will shed some insight. Maybe it is just the computer I'm on, or something else I did, but I get:
Error (RT) in "Exell /443"oExell: 0x80010105, The server threw an exception.
Heres the code that worked in QM Version 2.2.1
Function
Exell
;;All of this will run hidden...
;;so you won't see a thing happen
;;except for outputting variables in QM.
;;Declares the filepath for Excel file to use
str sfile="$desktop$\Test.xls"
;;Declares the name of the sheet to use
;;Make sure the name of the sheet is correct!!
str sheet="Sheet 1"
;;Works the Magic...doesn't seem to work in QM Beta 2.3.0.1...or I have the something wrong?!?
Excel.Application app._create
Excel.Workbook book=app.Workbooks.Open(_s.expandpath(sfile))
ExcelSheet es.ws=book.Worksheets.Item(sheet)
;;Declare the variable you want for data in QM
str Variable
;;Gets data from Sheet in cell row 1 column 1 and puts it to "Variable"
es.GetCell(Variable 1 1)
;;Puts "New Data" into cell row 1 column 1
es.SetCell("New Data" 1 1)
out Variable
;;Saves the Excel sheet
book.Save
;;Closes the Excel
book.Close
Posts: 12,071
Threads: 140
Joined: Dec 2002
the code works well here.
QM 2.3.0, Office 2003, Vista.
Posts: 12,071
Threads: 140
Joined: Dec 2002
Macro
;/exe 1
out
ARRAY(str) a
ExcelSheet es.Init
es.GetCells(a) ;;gets all cells. To get only selected cells, use this: es.GetCells(a "sel")
int r c
for r 0 a.len
,if(mes("Row %i" "" "OC" r+1) != 'O') break
,for c 0 a.len(1)
,,str& s=a[c r]
,,out s
Posts: 1,000
Threads: 253
Joined: Feb 2008
It's probably just my computer...I haven't ran an excel code in QM 2.3 until today. Good to know it still works. I'll keep you updated if I have any troubles when I get to my other computer.
Thanks.
Jimmy Vig
**Update...totally works on my other two computers. Must just be something with my computer at the radio station.