LoginSignup
0
1

More than 5 years have passed since last update.

メモを新規作成するマクロ

Last updated at Posted at 2015-05-19
'-------------------------------------------------------------------------------
'新規メモの作成マクロ
'
' CopyRight Naoshi Ide 2015-
'-------------------------------------------------------------------------------
Call Main

'メイン処理
Sub Main()
    Dim memofolder
    Dim strDate
    Dim memoFileName
    Dim memoFileObj

    memofolder = "C:\Users\Nao\Documents\個人フォルダ\10.メモ\"

    strDate = Date
    strDate = Replace(strDate, "/", "")


    text = InputBox("メモのタイトルを入力してください","memo")

    If text="" then
        Exit Sub
    End If

    memoFileName = memoFolder & strDate & "_" & text & ".memo"

    'ファイルの新規作成
    Dim objFileSys
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    objFileSys.CreateTextFile memoFileName
    Set memoFileObj = objFileSys.OpenTextFile(memoFileName, 2, True)

    memoFileObj.WriteLine("■" + text)
    memoFileObj.Close

    FileOpen(memoFileName)
End Sub

0
1
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
0
1