1

I am creating a bunch of workbooks and I want them to become shared workbooks, because it is complicated now to make workbooks shared because it is considered a legacy option. I am trying to make them all shared with autohotkey, but I don't know the syntax for something like this. This is what I tried:

try {
    Excel := ComObjActive("Excel.Application")
} catch e {
    msgbox Error. Click OK to Retry
    Excel := ComObjActive("Excel.Application")
}
Excel.ActiveWorkbook.SaveAs(excel.activeworkbook.fullname, 51, 0, 0, 0, 0, "xlshared", 0, 0, 0, 0, 0)

I found this function definition, but I don't know the parameter format, and when I leave some blank AHK doesn't like it: SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)

catquas
  • 712
  • 1
  • 5
  • 7

1 Answers1

1

Thanks to cybernetic.nomad pointing me in the right direction, I have an answer!

Excel := ComObjActive("Excel.Application")
Excel.ActiveWorkbook.SaveAs(excel.activeworkbook.fullname, 51, "", "", 0, 0, 2, 2)

51 means xlsx. the two "" mean no password for opening or editing. The first 2 means make it shared, the second 2 means automatically accept local user changes.

catquas
  • 712
  • 1
  • 5
  • 7