Excel VBA のユーザーフォームで GUI アプリケーション風のツールを作れたら素敵かなと思い試行錯誤した結果。
1. フォームそのものしか表示しないようにする
1.1. ブックを開いたら自動でフォームを表示
Private Sub Workbook_Open()
Userform1.Show
End Sub
1.2. ブックを小さくしてフォームの裏側に隠す
Private Sub Workbook_Open()
Application.WindowState = xlNormal
Windows(Application.ThisWorkbook.Name).Width = Userform1.Width - 30
Windows(Application.ThisWorkbook.Name).Height = Userform1.Height - 30
Userform1.Show
End Sub
1.3. フォームを移動するとブックも自動で追随するようにする
Private Sub UserForm_Layout()
Windows(Application.ThisWorkbook.Name).Top = Me.Top + 10
Windows(Application.ThisWorkbook.Name).Left = Me.Left + 10
End Sub
この方法の欠点としては、フォームを高速で移動させると、PCのスペックによっては、ブックの残像が見えて見苦しくなったりする。
2. フォームを閉じたらブックも閉じるようにする
2.1. フォームを閉じたらブックも閉じる
Private Sub UserForm_Terminate()
ThisWorkbook.Close
End Sub
これだと、ブックを開いていない状態の、空のエクセルのウィンドウが開きっぱなしになってしまうので、
2.2. 別のブックが開いている場合、フォームの含まれるブックしか閉じないようにする
Private Sub UserForm_Terminate()
If Workbooks.Count = 1 Then Application.Quit
ThisWorkbook.Close
End Sub
これでOK!
This is particularly true in terms of|in relation to} slots, so you 카지노 can get get} in loads of further spins. All our top-rated sites offer glorious bonuses for a fantastic begin to your online slots expertise. The video games themselves all offer high payout percentages to give you the finest return on your wager, and cashing out any huge win may be very simple with all well-liked banking choices. If you’re a winner, have the ability to|you probably can} count on any funds to be in your account inside hours. The finest playing sites will after all have video games software program from top developers, such as Playtech, BetSoft and Microgaming. You can certain to|make sure to|remember to} discover slots with great graphics and loads of dynamic options that will run smoothly, whether it’s a desktop, iPhone or mobile system that you’re utilizing.
返信削除