ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] «OÅ@vba·½½Xªº¤èªk±´°Q

[µo°Ý] «OÅ@vba·½½Xªº¤èªk±´°Q

¦pÃD¡G
ºô¸ô¤W¬y¶Çªº¤èªk¡A¤j³¡¥÷³£¬OVBAProjectÄÝ©Ê¥[¤J±K½X¡C
¦ý»¡¯uªº¡A³o¤@©Û®Ú¥»¨S¥Î¡Aºô¸ô¤W³£§ä±o¨ì¯}¸Ñ¤èªk¡C¤p§Ì¤]¯}¸Ñ¹L§O¤H¥[±Kªºvba·½½X¡C¤£¬O¬°¤F°½®v¡A¦Ó¬O³æ¯Â·Q¸Õ¸Õ³oºØ¯}¸Ñªk¯uªº¦³¥Î¶Ü¡AÅçÃÒµ²ªG¡A¬O¦³¥Îªº¡C
excel Àɮ׳s¶}³£¤£¥Î¶}¡A´Nª½±µ³Q¯}¸Ñ¤F¡C¯}¸Ñ«á¡A¦A¥´¶}excel¡A±K½X«OÅ@´N¨ú®ø¤F¡A§@ªÌªºvba·½½X³Q¬Ý±o¤@²M¤G·¡¡C

·Q½Ð±Ðª©¤W°ª¤â­Ì¡C¦pªG¤£¨Ï¥ÎVBAProjectÄݩʪº¥[±K¤èªk¥h«OÅ@¦Û¤w¼gªºvba·½½X¡A
½Ð°ÝÁÙ¦³¤°»ò§ó¦nªº¤èªk¶Ü?
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

¤p§Ì¥ý¦b¦¹©ß¿j¤Þ¥É¤@¤U¡A·Q¨ì¤@­Ó¸Ñ¨M¤è®×

¦bvba¼g¤U¤@¬qµ{¦¡½X
¥u­nvisual Basic©Î¥¨¶°³o¤G­Ó¥\¯à³QÂIÀ»¶}±Ò¡A´N¥X²{¤@²Õ±K½X¡C
¿é¤J¿ù»~¡A³o¼u¥Xªºvbeµøµ¡©Î¥¨¶°µøµ¡¥ß¨è¦Û°ÊÃö³¬¡C

¥i¯à±o¥Î¨ì´M§äµ¡Å骺¥\¯à

¦ý¦p¦ó¼g¨ì°»´ú³o¤G­Óµ¡Åé³Q¥´¶}¡A¨t²Î¤£Â_°»´ú³o¤G­Óµøµ¡ªºª¬ªp«o¤S¤£¦û¸ê·½¡A¥i¯à±o¦A·Q¤@·Q¥i¦æ©Ê¤F¡C
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 2# ketrddem

Lockxls=>¥I¶O³nÅé
±NEXCELÂର.EXEÀÉ®×
°Ñ¦Ò¤§~
http://www.lockxls.com/product.asp
PKKO

TOP

¦^´_ 3# PKKO


    «z¡A¬Ý¤F°â»ù
³o¥I¶O³nÅé¤]¤Ó¶Q¤F§a
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 1# ketrddem


    ¥H¤U¬O¥t¤@«ä¦Ò¼Ò¦¡¡A¤£ª¾¬O§_¥i¦æ?
Private Sub Workbook_Open()
   (¬O§_¯à¦b³o­Ó¦a¤è¼g¤@¬qvab ¥Hbyte ªº¤è¦¡Åª¨ú workbook ·j´M©ñ¸m±K½Xªº¦a¤è¡A¨Ã¸m¤J¦Û¤vªº±K½X?)
End Sub

TOP

¦^´_ 1# ketrddem
¦³¿³½ì¥i¥H°Ñ¦Ò¤j®vªº¬ã¨s
http://forum.twbts.com/viewthread.php?tid=51
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 6# stillfish00


    ¦³¦bÃöª`³o¦ìª©¥Dªº¤å³¹
¦ý¦³¨Ç¤èªk³£¤w¦³¯}¸Ñªk
¤p§Ì¦]¼g¥X¤@®M¨t²Î¡A·Q»¡¥i¥HÀ|¸Õ®³¥X¨Ó½æ¡A¦ý.....·½½Xªº«OÅ@¬O§Ú³Ì½T¤Á­n§¹¬ü¹ê²{ªº³¡¥÷
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 5# Scott090


­«ÂI¦³¡uvb±M®×¤£¥i²{¡vªº¹ê²{
¦pªG¥H²{¦³vb±M®×ªº±K½X«OÅ@¡A¯}¸Ñ¤èªk®Ú¥»¤£¥Î¶}±Ò¥»ÀÉ¡A¦Ó¬O¥Î¥t¤@­Ó³nÅé¡A«ü©wÀɮ׸ô®|´N¥i¥H±N±K½X¨ú®ø±¼
¦pªG¦³¤èªkÅývbe§¹¥þ¥´¤£¶}¡A¨º´N§¹¬ü¤F¡C
©Î¬Ovbe¥´¶}¤F¡A°¨¤W³QÃö±¼¡A¨º¤]ÆZ¤£¿ùªº¡C
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¸T¥ÎVBE½s¿èµ¡¤f

Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
vbewin = False
End Sub
Private Sub Workbook_Open()
'Àɮ׶}±Ò«e¥ýÃö³¬VBEµøµ¡(¦pªGVBEµøµ¡¤w¶}±Ò)
If Application.VBE.MainWindow.Visible Then
Application.VBE.CommandBars.FindControl(ID:=752).Execute
End If
vbewin = True
VBEwindow
End Sub
'-----------------------------------------------------------------
Public Declare Function GetActiveWindow Lib "user32" () As Long
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, _
ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Public vbewin As Boolean
Sub VBEwindow()
'ª½¨ìÀÉ®×Ãö³¬
Do While vbewin
DoEvents
Call CheckVBE_Event
Loop
End Sub
Sub CheckVBE_Event()
Dim hwnd As Long
Dim WText As String
Dim L As Long: L = 255
WText = String(255, " ")
'¨ú±o·í«eµøµ¡ Hwnd
hwnd = GetActiveWindow
'¨ú±o·í«eµøµ¡Ãþ§O¦WºÙ
L = GetClassName(hwnd, WText, L)
WText = Left(WText, L)
'VBEµøµ¡ªºÃþ§O¦WºÙ¬°:wndclass_desked_gsk
If WText = "wndclass_desked_gsk" Then
MsgBox "¤w°»´ú¨ìVBEµøµ¡¶}±Ò¡AVBEµøµ¡±N¦Û¦æÃö³¬"
'Ãö³¬VBEµøµ¡
Application.VBE.CommandBars.FindControl(ID:=752).Execute
End If
End Sub

'----------------------------------------------------------------------------------------------
»¡©ú:
Excel µøµ¡ªº ClassName="XLMAIN"
Application.VBE.CommandBars.FindControl(ID:=752)´N¬OVBEµøµ¡¤¤ªº ÀÉ®×=>Ãö³¬¨Ã¦^¨ì MicrosoftExcel
VBE µøµ¡ªº ClassName="wndclass_desked_gsk"
UserForm µøµ¡ªº ClassName="" ThunderDFrame"¡A¦pªG¬OExcel 97ª©(§t)¥H«áªº«h¬° ClassName="ThunderXFrame"



¦bºô¸ô¤W§ä¨ì³o­Ó±Ð¾Ç
¦ý¤£ª¾¬O¤£¬Oª©¥»°ÝÃD
§Ú¸Õ¹L¤F
µ²ªGÅܦ¨¥þ³¡ªº¥\¯àÁä¥þ³£³Q¸T¤î¤F¡A¥u³Ñ¤UÀx¦s®æ¥i¥H¨Ï¥Î¡C
¦³¨S¦³°ª¤âÄ@·N¥X¤â¬Û§U¡A¬Ý¤@¤U¬O¨º¤@¬qµ{¦¡½X¶·­×§ïªº©O?
¤p§Ì¨Ï¥Îªº¬O office 2013 32¦ì¤¸
EXCEL VBA·s¤â¡A½Ð«e½ú¦h¦h«ü±Ð

TOP

¦^´_ 9# ketrddem
¦Ñ¹ê»¡¥´¶}®É¤£±Ò¥Î¥¨¶° ©Î¬O «öShift¥´¶}¸õ¹Lworkbook_open()¡A¨º´N¨S¥Î¤F¡C
¥ÎVBAµ{¦¡¨Ó«OÅ@ªº¤èªk¡A°ò¥»¤W³£­n­±¹ï³o­Ó°ÝÃD¡C
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

        ÀR«ä¦Û¦b : ¦³®É·í«äµL®É­W¡A¦n¤Ñ­n¿n«B¨Ó³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD