LoginSignup
1
0

More than 3 years have passed since last update.

Excelを一太郎に変換するVBScript

Posted at

概要

 Excelを一太郎に変換するというニッチな需要に応えるものです。
 もちろん、お使いのパソコンに一太郎が入っていなければ使えません。

 現在のエクセル拡張子(xlsx,xlsm)は一太郎で開けなくなったので、以前のバージョン(xls)を経由して変換します。
 なので、以前のExcelでサポートされていない部分にエラーが出ます。たとえば、日付が令和なのに平成になったりします。
 右の方の列が省略されてしまうときは、列幅を狭くして実行してみてください。

スクリプト

VBScript

Option Explicit
Dim excelFilePath
    If Wscript.arguments.Count = 0 Then
        MsgBox "一太郎に変換したいExcelファイルをドラッグ&ドロップしてください"
        Wscript.Quit
    Else
        excelFilePath = Wscript.arguments(0)
    End If
Dim excel, excelBook
Set excel = CreateObject("Excel.Application")
excel.Visible = True
Set excelBook = excel.Workbooks.Open(excelFilePath)
        Dim withoutExtensionPath
        withoutExtensionPath = Split(excelFilePath, ".")(0)
    If Split(excelFilePath, ".")(1) <> "xls" Then
        excelBook.SaveAs withoutExtensionPath & ".xls", -4143
    End If
excelBook.Close False
Set excel = Nothing
Dim taro
Set taro = CreateObject("JXW.Application")
taro.TaroLibrary.OpenDocument (withoutExtensionPath & ".xls")
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0