> (e-mail address removed) wrote:
>
> > Version: 2008
> > Operating System: Mac OS X 10.6 (Snow Leopard)
> > Processor: Intel
> >
> > Hi, Just "discovered" the wonderful world of Applescript!
> > I'm attempting to have the input from a prompt box enter into a specified
> > cell and then populate another sheet as well as change the name of that
> > sheet's tab. I'm able to open the correct worksheet and bring up the
> > necessary sheet. I can also get the prompt box to come up...I then want
> > whatever name is inputted to replace cell "A2"...which would then
> > change the student name on the first student sheet (through an existing
> > simple excel reference)...as well as change the tab of the first student
> > sheet...I'll keep searching but if anyone has a suggestion, I'm all ears!
>
> Perhaps something like:
>
> tell application "Microsoft Excel"
> try
> open workbook workbook file name "test.xlsx"
> set myRange to range "A2" of worksheet "list"
> set myName to input box prompt �
> "Please replace provided text with a Student Name" title "Students"
> set value of myRange to myName
> set name of sheet 2 to myName
> end try
> end tell
> [/QUOTE]
Thanks Mr. McGimpsey! Here's what I came up with:
tell application "Microsoft Excel"
try
open workbook workbook file name "test.xls"
activate object worksheet "names"
set myRange to range "A2" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 3 to myName
set myRange to range "A3" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 4 to myName
set myRange to range "A4" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 5 to myName
set myRange to range "A5" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 6 to myName
set myRange to range "A6" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 7 to myName
set myRange to range "A7" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 8 to myName
set myRange to range "A8" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 9 to myName
set myRange to range "A9" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 10 to myName
set myRange to range "A10" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 11 to myName
set myRange to range "A11" of worksheet "names"
set myName to input box prompt "Please type a Student Name" title "Students"
set value of myRange to myName
set name of sheet 12 to myName
end try
end tell
1) How do you put in this little guy "¬" so the whole script shows up correctly in the forum?
2) I would need to send the .xls file in question along with the script, yes? (they all have excel) If they place the script on the desktop, that would be okay?
3) when the script runs, Excel opens the file but then sends it to the dock where it bounces...surely there is a way to keep the application open?
4) This won't help any PC Excel users?
5) Again, thanks for the guidance! I truly appreciate it!