Hello, I’m new to applescript. I have excel 2008 and Mac osx 10.5. I’m trying to write a script to compare column B of one excel file to column B of the another excel file.
I will have to had a repeat loop to proceed down the column but I’m stuck on the find command.
Below is some of the code I have so far. The applescript error message is “Microsoft Excel got an error: The object you are trying to access does not exist. It highlights the find column.”
set patientFile to choose file with prompt "Please select the patient Excel file:"
set patientName to name of (info for patientFile)
tell application "Microsoft Excel"
open patientFile
set thepatientFile to workbook patientName
end tell
display dialog "Is your patient SNP data in column B of the " & " " & patientName & " " & "excel file?" buttons {"No", "Yes"} default button 2
if the button returned of the result is "No" then
display dialog "Please put your data in column B" buttons {"Cancel"} default button 1
if the button returned of the result is "Cancel" then
end if
else
display dialog "Is column E empty? The results of this program will be stored in column E of the" & " " & patientName & " " & "excel file." buttons {"No", "Yes"} default button 2
if the button returned of the result is "No" then
display dialog "Please put your data in empty column E" buttons {"Cancel"} default button 1
if the button returned of the result is "Cancel" then
end if
else
set relativeFile to choose file with prompt "Please select the relative Excel file:"
set relativeName to name of (info for relativeFile)
tell application "Microsoft Excel"
open relativeFile
set therelativeFile to workbook relativeName
end tell
end if
end if
display dialog "Is your relative SNP data in column B of the" & " " & relativeName & " " & "excel file?" buttons {"No", "Yes"} default button 2
if the button returned of the result is "No" then
display dialog "Please put your data in column B" buttons {"Cancel"} default button 1
if the button returned of the result is "Cancel" then
end if
else
display dialog "Does column C contain the result data you would like copied from" & " " & relativeName & " " & "excel file?" buttons {"No", "Yes"} default button 2
if the button returned of the result is "No" then
display dialog "Please put the data you would like copied in column C." buttons {"Cancel"} default button 1
if the button returned of the result is "Cancel" then
end if
else
tell application "Microsoft Excel"
activate object workbook patientName
copy value of cell "A1" to cellPatientFile
find (range "B:B" of workbook relativeName) what cellPatientFile
if cellPatientFile is true then
set bold of font object of cellPatientFile to true
end if
end tell
end if
end if
Does any one have any hints towards solving this problem? Thank you for any help.