春風邪のスルメ > ゲーム雑記帳
スルメがやっているゲームについてのメモや感想を綴る予定。意味不明な単語が出ても気にしないでください。不定期更新です。
FF2よ永遠なれ エスト2攻略講座 RPG INSTITUTE グロー4攻略講座
過去にネタにした主なゲーム:アルトネリコ2 ロマサガ3 アルトネリコ ミンサガ
Sub ExportSelectedRangeToCSV() rem---------------------------------------------------- rem 基本設定 Dim oDoc, oURL, sURL, sBase, sSheetName, stempSheetName, sFile, sFileName, oPV(1) As New com.sun.star.beans.PropertyValue Dim oSheet, oController, oSelection, document, dispatcher As Object Dim Array() GlobalScope.BasicLibraries.LoadLibrary("Tools") oURL = StarDesktop.CurrentComponent.getURL oDoc = StarDesktop.CurrentComponent oSheets = oDoc.getSheets() oController = oDoc.getCurrentController() oSelection = StarDesktop.CurrentComponent.getCurrentSelection document = StarDesktop.CurrentComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") stempSheetName = "TempSheet" On Error Goto ErrorExit If Not oDoc.supportsService("com.sun.star.sheet.SpreadsheetDocument" ) Then Goto ErrorExit If Not oDoc.hasLocation() Then Goto ErrorExit sURL = oDoc.URL sURL = ConvertFromURL(sURL) sFileName = FileNameOutOfPath(oURL) If mid(sURL, Len(sURL) - 3, 1) <> "." Then Goto ErrorExit rem sBase = Left(sURL, Len(sURL) - 4) sBase = Left(sURL, Len(sURL) - Len(sFileName)) sBase = ConvertToURL(sBase) sSheetName = oDoc.CurrentController.ActiveSheet.Name rem sFile = sBase + "_" + sSheetName + ".csv" sFile = sBase + sSheetName + ".csv" rem---------------------------------------------------- rem 作業用シートの作成 dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) If oSheets.hasByName( stempSheetName ) Then oSheets.removeByName( stempSheetName ) End If Dim args1(1) As New com.sun.star.beans.PropertyValue args1(0).Name = "Name" args1(0).Value = stempSheetName args1(1).Name = "Index" args1(1).Value = 1 dispatcher.executeDispatch(document, ".uno:Insert", "", 0, args1()) dim args2(5) as new com.sun.star.beans.PropertyValue args2(0).Name = "Flags" args2(0).Value = "SVD" args2(1).Name = "FormulaCommand" args2(1).Value = 0 args2(2).Name = "SkipEmptyCells" args2(2).Value = false args2(3).Name = "Transpose" args2(3).Value = false args2(4).Name = "AsLink" args2(4).Value = false args2(5).Name = "MoveMode" args2(5).Value = 4 dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args2()) rem---------------------------------------------------- rem CSVファイルをエクスポート wait 500 oPV(0).Name = "FilterName" : oPV(0).Value = "Text - txt - csv (StarCalc)" oPV(1).Name = "FilterOptions" : oPV(1).Value = "44,34,64,1" oDoc.storeToURL sFile, oPV() rem---------------------------------------------------- rem 作業用シートの削除 If oSheets.hasByName( sSheetName ) Then oController.setActiveSheet(oSheets.getByName( sSheetName )) End If If oSheets.hasByName( stempSheetName ) Then oSheets.removeByName( stempSheetName ) End If Exit Sub ErrorExit: Print "This macro can only save a select Sheet from a saved File" On Error Goto 0 End Sub