Excel 2010 を使用しており、次のマクロを使用しようとしています。
- 名前を付けて保存ダイアログボックスを開く
- 最初のファイル名を取得し、ファイル タイプ (つまり .xlsx) の前にアンダースコアの後に 8 つの連続した整数 (つまり _12345678) があるかどうかを確認します。
- それが存在する場合は、削除してアンダースコアに置き換え、その後にファイルタイプ (.xlsx) の前に「yyyymmdd」形式 (つまり、_20130730) の今日の日付を続けます。
- それが存在しない場合は、ファイルの種類 (つまり .xlsx) の前にアンダースコアとそれに続く "yyyymmdd" 形式 (つまり _20130730) の今日の日付を追加するだけです。
- 上記の基準に基づく新しいファイル名は、開いている [名前を付けて保存] ダイアログ ボックスの [ファイル名] フィールドに表示されますが、ユーザーは実際にファイルを保存する必要があります (名前を付けて [名前を付けて保存] を開くだけです。実際に VBA で保存するわけではありません)。
- 元のファイルの種類が何であれ維持する
今日の日付が2013
年7 月 30日であると仮定すると、マクロは次の開始ファイルに対して次のように動作します
。.xlsx
どんな助けでも大歓迎です!ありがとう