Excel: save as .xls using the value of two cells and and a given path

Hi Guys,
hope somebody can help me with this. I’m very new at Apple script and at scripting in general. I used to use Excel 2004 and vba macros (without knowing vba at all, using only the registration button and some help around the net) but now I have the need to pass to Excel 2008 and therefore using Apple script.
I have my code in vba (I didn’t put etiquettes because it’s not applescript), can anybody help me to converti it?
Furthemore I would need to put a condition: i.e. depending of the starting 3 characters put in the first cell (C3), changing the path of destination.
Thank you very much!! Marzia

Sub salva()
Dim C As String
C = “” & Range(“C3”) & “-” & Range(“J1”).Value
ActiveWorkbook.SaveAs Filename:=“Marcie:DOCUMENTI:” & C & “.xls” _
, FileFormat:=xlNormal, Password:=“”, WriteResPassword:=“”, _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

Hello.

You should be able to find a 3 part I think (VBA to AppleScript Transition guide in the archives of http://www.mactech.com/

Thank you McUsr, I know already the guide but since I’m a beginner in programming i guess I need a month studying to be able to do it myself (plus english is not my first language…)…unfortunately i run out of time to solve this particular thing. So…any help would be greatly appreciated. Thank you again. Marzia

Hello.

I believe you should be able to make this work for you.


set savePath to "YOUR PATH"
tell application "Microsoft Excel"
	set a to value of cell "c3" of active sheet of active workbook
	set b to value of cell "j1" of active sheet of active workbook -- as integer if it is a number here
	set c to (a as text) & b as text
	tell active workbook
		save workbook as filename savePath & c & ".xls" file format Excel7 file format password "" write reservation password "" without create backup
	end tell
end tell

Thank yoy McUsr, it’s very kind of you. I’ll try and let you know if I manage to sort it out. Have a good day! Marzia :slight_smile: