Save As in Excel 2008

This is going to be part of a larger script. I’m trying to figure out how to make the default save location to where the current opened file resides and the default file name to the current filename in the dialog box.

Here is what I go so far…

tell application “Microsoft Excel”
tell active workbook
set myFile to choose file name with prompt “Save file as:”
end tell
end tell

I’m very new with working with Applescript, so at this point I have been piecing together code snippets.

Any help would be great and thank you

tell application "Microsoft Excel"
	activate
	set myPath to (get save as filename)
end tell

Thank you for the fast reply! I’m still having a little trouble, that you might have some knowledge with. The code calls the save box up and makes the name the current file, but not the current file’s location.

If it helps here is the backstory to what I’m trying to accomplish. I’m not sure if it’s preference or bug, but in Excel 2008 when you “Save As” it uses the the last “save as” location rather than where the current file resides. When you save everything in documents it’s not a problem but I have 25 subfolders that I work with, so I’m hoping applescript can be a solution.

Thank you for your help so far.

Does this do what you want?

tell application "Microsoft Excel"
	set {currentName, currentFolder} to {name, path} of active workbook
	
	set saveAsFileName to (choose file name default name currentName default location (currentFolder as alias))
	
end tell
return saveAsFileName