Excel VBA マクロを OpenOffice 基本マクロに移植する方法は?
これは、5 秒ごとに更新するためのマクロです。
Private Sub Workbook_Open()
' Written in ThisWorkbook
Call RefreshTime
End Sub
Sub RefreshTime()
' Written in a module
Application.ScreenUpdating = False
ActiveWorkbook.RefreshAll
Application.OnTime Now + TimeValue("00:00:05"), "RefreshTime"
Range("B10").Value = "My Current Time of the System:"
Range("C10").Value = Format(Now, "hh:mm:ss AM/PM")
Beep
Application.ScreenUpdating = True
End Sub
このマクロを OpenOffice マクロに変換してみました ( http://www.business-spreadsheets.com/vba2oo.aspを使用)
Private Sub Workbook_Open()
' Written in ThisWorkbook
Call RefreshTime
End Sub
Sub RefreshTime()
' Written in a module
ThisComponent.LockControllers
ThisComponent.RefreshAll
Application.OnTime Now + TimeValue("00:00:05"), "RefreshTime"
ThisComponent.CurrentController.ThisComponent.CurrentController.ActiveSheet.getCellDim oSheet as Object[n]oSheet = ThisComponent.CurrentController.ActiveSheet[n]oSheet.getCellRangeByName($1)ByName(("B10")).Value = "My Current Time of the System:"
ThisComponent.CurrentController.ThisComponent.CurrentController.ActiveSheet.getCellDim oSheet as Object[n]oSheet = ThisComponent.CurrentController.ActiveSheet[n]oSheet.getCellRangeByName($1)ByName(("C10")).Value = Format(Now, "hh:mm:ss AM/PM")
Beep
ThisComponent.UnlockControllers
End Sub
このコード行により、次の構文エラーが発生します。
ThisComponent.CurrentController.ThisComponent.CurrentController.ActiveSheet.getCellDim oSheet as Object[n]oSheet = ThisComponent.CurrentController.ActiveSheet[n]oSheet.getCellRangeByName($1)ByName(("B10")).Value = "My Current Time of the System:"
しかし、エラーが発生しました
BASIC 構文エラー。期待される:、。
オブジェクトとして oSheet で。
OpenOffice で動作させるにはどうすればよいですか?