VBSの質問です
Dim str_path
Set objFS = CreateObject("Scripting.FileSystemObject")
objFS.CopyFolder ".\hoge1\2014", ".hoge11\2014"
objFS.CopyFolder ".\hoge2\2014", ".hoge22\2014"
・
・
・
・
というプログラムがあります
年度が変わるごとに 2014の所を 2015に変えたりします
全て変更するのは大変なので 一箇所変更すれば全て変更できるような仕組みにしたいのですがどうすればいいでしょうか?
教えてください
↓
こんな感じです
Dim str_path
year=2014
Set objFS = CreateObject("Scripting.FileSystemObject")
objFS.CopyFolder ".\hoge1\"year"", ".hoge11\"year""
objFS.CopyFolder ".\hoge2\"year"", ".hoge22\"year""
・
こんな感じでしょうか。
year = "2014"
Dim str_path
Set objFS = CreateObject("Scripting.FileSystemObject")
objFS.CopyFolder ".\hoge1\" & year , ".hoge11\" & year
objFS.CopyFolder ".\hoge2\" & year , ".hoge22\" & year
VBS で文字列をくっつけるのは、& を使います。