activating open excel workbook among open excel workbooks

Dear apple friends ,

I am working with and apple script and excel files . As per the requirement I have to extract the specific data from all excel file ( containing many sheets of different types) and paste them into target file sheet in a specific order to convert into text file then → mysql.I have to copy data from source file excel sheet to target file excel sheet , but the command "activate workbook workbook target_book_name " is not working and not giving any error in the subroutine.After executing this command still the active wookbook is the source book and it is pasting the data on the same sheet instead of pasting the data on target sheet. Any help for this will be highly appreciated .

thanks in advance
krishna

The general flow of script is as follows :

I getting the names of the files by using the following command :

tell application “Finder”
set source_files_list to every file of folder source_folder
end tell

in the loop for all files i am using the following commands

repeat with source_file_name in source_file_list
if target_file_open_status is equal to 0 then
open workbook workbook file name target_excel_file
set target_book_name to name of active workbook
set target_file_open_status to 1
end if

	set source_file_name to source_file_name as string
	open workbook workbook file name source_file_name
	set source_book_name to name of active workbook

set sheet_names_list to get name of every sheet of workbook source_book_name

   repeat with sheet_name in sheet_names_list 
  
  my       get_sheet_data(sheet_name)


  end repeat 

–end of loop for all files of dir
end loop

–getting adata

on get_sheet_data(sheet_name)

-copying data from source file sheet

activate sheet sheet_name

copy range “specified_range”

–problem area
activate workbook target_book_name
activate sheet “target_shhet”

paste copied data on targeted sheet

end get_sheet_data

Hi krishna,

try it with


...
 activate object workbook target_book_name 
 activate object sheet "target_shhet"
...

do you know the Excel 2004 AppleScript Reference?