64bit Office automation - saveAsWord

When I try to save a Word document in a 64Bit application, I got this error:

Unknown error: -2147417851, (failed on “SaveAs2”)

This is my line that saves the file:
word.ActiveDocument.SaveAs2 (f.NativePath, 12)

Save as DOCX format
word.ActiveDocument.SaveAs2 (f.NativePath, 16)

Same error message!

In a 32Bit application there is no error.

Those two numbers are probably 32-bit integers in the api, but are now being passed as 64-bit. Try:

word.ActiveDocument.SaveAs2 (f.NativePath, Int32(12))

UserInfoWindow.ExportToWord, line 125
Type mismatch error. Expected Int32, but got Int64
word.ActiveDocument.SaveAs2 (f.NativePath, int32(16))

This is the correct value!

word.ActiveDocument.SaveAs2 (f.NativePath, 16.0)