Application.EnableEvents = True ¥¢®Ä
- ©«¤l
- 759
- ¥DÃD
- 249
- ºëµØ
- 0
- ¿n¤À
- 1021
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 11
- ³nÅ骩¥»
- OFFICE2021
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-5-30
- ³Ì«áµn¿ý
- 2024-11-24
|
Application.EnableEvents = True ¥¢®Ä
1.xls¤w¶}±Ò Application.EnableEvents = True §@¥Î¤¤
¶}¤F2.xls «á, 1.xlsµo¥Í¨Æ¥óPrivate Sub Worksheet_Calculate()³£µLªk§@¥Î??
sub test()
Application.EnableEvents = False '¤w´ú¸Õ¦³µL¦¹¦æ¨S®t
For Each wb In Workbooks
If wb.Name = "2.xls" Then GoTo 58
Next
Workbooks.Open Filename:="k:\xls3\2.xls"
58:
If Windows("2xls").Visible = False Then
Windows("2.xls").Visible = True
ElseIf Windows("2.xls").Visible = True Then
Windows("2.xls").Visible = False
End If
Application.EnableEvents = True 'event¤wµLªk§@¥Î
End Sub
n¦b1.xls°õ¦æ
sub tes2()
Application.EnableEvents = True
end sub
¤~·|«°_§@¥Î |
|
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¥»©«³Ì«á¥Ñ singo1232001 ©ó 2022-11-20 16:47 ½s¿è
¦^´_ 1# t8899
·íµ{§Ç½ÆÂø¨ì¤@©wµ{«× ·|²£¥ÍÃþ¦ü°ÝÃD
³Ì²×¸Ñ¨M¤è®×´N¬O³]¤@Ó¼s°ìÅܼÆ
©ñ¦bµ{§Ç¥~
¨Ò¦p
public xxx as boolean
sub test()
xxx = true
end sub
³o¼Ë³B²z«á
¦bIJµo¨Æ¥ó
´N¯à¥Î if xxx= false then ªº¤è¦¡Á׶}
¦ýÁÙ¦³¤@ºØ±¡ªp ¤ñ¸û¯S§O
§A¹J¨ìÀ³¸Ó¬O³oºØ±¡ªp ¸I¨ì¦³¶}±Ò¤u§@諸¾Þ§@
Ãö³¬ªºexcel ¥»¨ÁÙ¦bI´º¨Ã¥¼¯u¥¿Ãö³¬ ¤j·§´N¬O¾ã¤ù³£¦Ç¦âªº
³oºØ¤è¬O§Ú¥Ø«e¥uª¾¹D¤@ºØ¸Ñ¨M¤è¦¡ (©Î³\ÁÙ¦³§ó¦nªº¤èªk ½Ð°ª¤â¸É¥R)
´N¬O¥Îset ªº¤è¦¡¶}±Ò¤u§@ï ÁקKÃö³¬Ãö¤£°®²b
Set ob = CreateObject("Excel.Application")
ob.Visible = False
Set os = ob.Workbooks.Open(¸ô®|)
Set osh = ob.Sheets("¤u§@ªí1")
ob.ActiveWorkbook.Close
ob.Quit
Set ob = Nothing
Set os = Nothing
Set osh = Nothing |
|
|
|
|
|
|
- ©«¤l
- 759
- ¥DÃD
- 249
- ºëµØ
- 0
- ¿n¤À
- 1021
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 11
- ³nÅ骩¥»
- OFFICE2021
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-5-30
- ³Ì«áµn¿ý
- 2024-11-24
|
¥»©«³Ì«á¥Ñ t8899 ©ó 2022-11-20 19:39 ½s¿è
¦^´_ t8899
·íµ{§Ç½ÆÂø¨ì¤@©wµ{«× ·|²£¥ÍÃþ¦ü°ÝÃD
³Ì²×¸Ñ¨M¤è®×´N¬O³]¤@Ó¼s°ìÅܼÆ
©ñ¦bµ{§Ç¥~ ...
singo1232001 µoªí©ó 2022-11-20 16:44
Set os = ob.Workbooks.Open(¸ô®|)
³o«ü¥OÁÙµLªk¶}ÀÉ?½Ð±Ð¦p¦ó¶}ÀÉ? |
|
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¥»©«³Ì«á¥Ñ singo1232001 ©ó 2022-11-20 20:36 ½s¿è
¦^´_ 3# t8899
ob.Visible = False ¥ý§ï¦¨ ob.Visible = true
YnI´º³B²z¤~¥Î
ob.Visible = False
§Ú½Æ»s®É§Ñ¤F§ï
¥t¥~¸ô®|n§ï¦¨§Aªº§¹¾ã¸ô®| ¸ò¤§«eopen¤è¦¡ªº¸ô®|¤@¼Ë
³Ì«án¦bª`·N¤@¤U ob.Visible = False ªº±¡ªp¤U ¤¤Â_µ{§Ç ¥i¯à·|¥dbug
¦bI´º¨SÃö³¬ ¨º´N±o¥Î¤u§@ºÞ²zû¥hÃö³¬excel¤F
´N¦p¦P§A¶}±Ò¤F¤@Ӭݤ£¨£ªºexcel ¥d¦bI´ºÃö¤£±¼ |
|
|
|
|
|
|
- ©«¤l
- 759
- ¥DÃD
- 249
- ºëµØ
- 0
- ¿n¤À
- 1021
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 11
- ³nÅ骩¥»
- OFFICE2021
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-5-30
- ³Ì«áµn¿ý
- 2024-11-24
|
¥»©«³Ì«á¥Ñ t8899 ©ó 2022-11-21 06:50 ½s¿è
¦^´_ t8899
ob.Visible = False ¥ý§ï¦¨ ob.Visible = true
YnI´º³B²z¤~¥Î
ob.Visibl ...
singo1232001 µoªí©ó 2022-11-20 20:33
1 ob.Visible = true
³o¦æ°õ¦æ§¹·|¦h¤@Ó¨S¥Îªº¦Ç¦âµøµ¡ (¨S¥Î¨ì)¡A¥i§_¬Ù±¼?
2 ¤Ö¤@¦æ Public ob As Object ?
ob.ActiveWorkbook.Close
ob.Quit
Set ob = Nothing
Set os = Nothing
Set osh = Nothing
ÃöÀɳo5¦æ©ñ¦b¥t¤@¥¨¶°¡AµLªk¦¨¥\ ?
3 ob.ActiveWorkbook.Close
³o©R¥OÃö³¬·|°Ýn¤£n¦sÀÉ??½Ð±Ðn¦s¸ò¤£n¦s«ü¥O¦p¦ó¤U? |
|
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
|
|
|
|
|
|
- ©«¤l
- 759
- ¥DÃD
- 249
- ºëµØ
- 0
- ¿n¤À
- 1021
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 11
- ³nÅ骩¥»
- OFFICE2021
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-5-30
- ³Ì«áµn¿ý
- 2024-11-24
|
§Ú쥻ªº°ÝÃD¤w¸g¸Ñ¨M¤F¡A¶}ÀÉ«á¼È°±15¬í´N¸Ñ¨M¤F
2.xls ¸Ì±¦³940Ó¸ê®Æ¥æ´«(DDE)nµ¥¨ì§¹¥þ§ó·s§¹¡A¤~¥i¥H°õ¦æ Application.EnableEvents = True
15¬íªºµ¥«Ý¡A쥻¥ÎDO loop¡A¦]¬°§ó·s¨S¦³¶¶§Ç¡A¤£ª¾³Ì«á¤@µ§§ó·s¬O¨º¤@µ§?¥u¦n§ì15¬íªºµ¥«Ý®É¶¡
Workbooks.Open Filename:="k:\xls3\2.xls"
DSTOP = Now: Do While Now - DSTOP < TimeValue("0:00:15"): DoEvents: Loop '¼È°±15¬í
¦h¾Ç¤F¤@Ó¶}Àɪº¤èªk¤]¤£¿ù |
|
|
|
|
|
|