Calc Basic Do loop while, select case

マクロの作成、スクリプトの作成、APIの使い方
返信する
jpb
記事: 2
登録日時: 1月 22, 2018, 11:21 am

Calc Basic Do loop while, select case

投稿記事 by jpb »

OpenOffice 初心者です。 Excel VBA でそのまま作動しないものを Calc Basic で書き直していますが、Do Loop While がよく分かりません。 下記が記述とその結果です。 Select Case が土曜で止まり、次は 8, 9, 10 の dateserial の日付が表示されます。 どこが間違っているのでしょうか。 ご指導頂けるとありがたいのですが。 又、Excel VBA では 入れ子の For でうまく作動しましたが、OpenOffice では作動しません。 

REM ***** BASIC *****
Sub Dating
Dim document as object
dim sheet as object
document = ThisComponent
sheet = document.sheets(7)

Dim i as integer
Dim j as date
Dim k as variant

i = 5
j = sheet.getCellByPosition(0, i).value
k = WeekDay(j)

Do
sheet.getCellByPosition(0, i).value = j
sheet.getCellByPosition(1, i).value = k
Select Case k
Case = 1
sheet.getCellByPosition(1, i).string = "(日)"
Case = 2
sheet.getCellByPosition(1, i).string = "(月)"
Case = 3
sheet.getCellByPosition(1, i).string = "(火)"
Case = 4
sheet.getCellByPosition(1, i).string = "(水)"
Case = 5
sheet.getCellByPosition(1, i).string = "(木)"
Case = 6
sheet.getCellByPosition(1, i).string = "(金)"
Case = 7
sheet.getCellByPosition(1, i).string = "(土)"

End Select
i = i + 6
j = j + 1
k = k + 1

Loop While i <= 334

End Sub

01/01/20 (水)





01/02/20 (木)





01/03/20 (金)





01/04/20 (土)





01/05/20 01/07/00





01/06/20 01/08/00
open office 4.1.5
windows10
返信する

“マクロと UNO API”に戻る