I saw few messages in the forum which indicates that some of us are struggling to select different sheet in excel workbook when they use fortran code to do that. I too was working on it and found a way to do it.....
NSHEET = $Worksheet_GetIndex(worksheet, status)
DO N = 2,NSHEET
worksheet = $Worksheet_GetPrevious(worksheet, status)
DO N = 1,100
sheet = $Worksheet_GetName(worksheet, STATUS)
IF(SHEET .EQ. SHEET1)GOTO 10
worksheet = $Worksheet_GetNext(worksheet, status)
the first line will return the active sheet index. one has to reach at first sheet to start search, and that's exactly happening thru first loop. Once you got the first sheet, start comparing the name of the sheet with predefined sheet1(character*(*) sheet1) and once u got it, come out of the loop.
I tried it in my code and it's working fine.....
let me know if any one need further explanation.......i am also able to set and get environment variable to access excel workbook and so i need not to hard code the entire path(remember legacy AUTODICE code)....i just mentioned it so that one can get info if needed...
thanks to all group member.
selecting excel sheet thru fortran
Sun, 11/23/2003 - 05:08