我想在Google云端硬盘上传一个Excel启用宏的工作簿,但谷歌不支持此文件。他们建议我将VBA转换为Javascript并使用ScriptEditỏ。我想在javascript中转换此功能,但我不知道它在哪里错了。你能给我一个帮助吗?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
With Target(1, 2)
.Value = Date
.EntireColumn.AutoFit
End With
End If
End Sub
Javascript转换尝试:1
如果您不想重写所有代码,请查找GSpread.NET。 VBA和GSpread.NET使用Microsoft Excel中的API与Google Spreadsheets配合使用。需要替换CreateObject(Excel.Application)
设置objExcel = CreateObject(“GSpreadCOM.Application”)
app.MailLogon(Name,ClientIdAndSecret,ScriptId);
并使用Google Spreadsheets作为普通的Microsoft Excel文档。