¡@¼ÊºÙ: ªü¦N ¡@ÀY»Î: ¤£®¢¤U°Ý,¤£Â_¾Ç²ß,¤~·|¶i¨B
ª©¥D
- ©«¤l
- 647
- ¥DÃD
- 190
- ºëµØ
- 24
- ¿n¤À
- 1037
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- Office 2010 ; OOO3.0 ; Google
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¦Ë«n
- µù¥U®É¶¡
- 2010-5-2
- ³Ì«áµn¿ý
- 2022-6-24
|
[Âà¶K] VBA±±¥óªº¦Û动ª`册ÉO链±µ库ªº¦Û动¤Þ¥Î¤èªk
¥»©«³Ì«á¥Ñ HUNGCHILIN ©ó 2011-2-10 23:03 ½s¿è
³o½gÁÙ¤£¿ù¤j®a¥i¥H¬Ý¬Ý
Âà©«¦Ûexcelpx
§@ªÌ:兰¦â¤Û·Q 发ªí¤_ 2007-11-19 18:06
VBA±±¥óªº¦Û动ª`册ÉO链±µ库ªº¦Û动¤Þ¥Î¤èªk
§A¬O§_¦³过这样ªº§x´b¡A别¤Hªº¤å¥ó©Î¥N码无ªk¦b¦Û¤w电脑¤W¥¿±`运¦æ¡C¦Z来¡A§Aª¾¹D¤å¥ó¤¤¨Ï¥Î¤F§A电脑¤¤没¦³ª`册ªº±±¥ó©Î对¶Hªº¤Þ¥Î¡C¤_¬O§A学会¤F¤â¤u设¸m¡A暂时¸Ñ决¤F这个问题¡C
±±¥óªºª`册©Î对¶H链±µ库ªº¤Þ¥Î¯à§_¥ÎVBA¦Û动§¹¦¨©O¡A¦pªG¯à实现¡A则´N¥i¥H实现VBAµ{§Ç¤å¥ó¯u¥¿ªº¦@¨É¡C
兰¦â¤À别´N±±¥ó¦Û动ª`册©M对¶Hªº¦Û动¤Þ¥Î写¤F¥H¤U说©ú¡A请¤j®a¦h¦h«ü点¡C
¤@¡B±±¥óª`册
ª`册±±¥óº¥ý电脑¤¤»Ýn¦³这个OCX¤å¥ó¡A©Ò¥H¥i¥H¦bEXCEL¤å¥ó夹¤U´£¨Ñ该±±¥ó¡AµM¦Z¥Îµ{§ÇÎ`¨î¨ìsystem32¤å¥ó夹¤¤¡AµM¦Z¨Ï¥Îshell¨ç数进¦æ±±¥óª`册¡C¥Hª`册¤é´Á±±¥ó为¨Ò¡A¥N码¦p¤U¡G
Sub ª`册¤é´Á±±¥ó()
dim d
On Error Resume Next
FileCopy ThisWorkbook.Path & "/MSCOMCT2.ocx", "C:\Windows\system32\MSCOMCT2.ocx"
d = Shell("regsvr32 C:\Windows\system32\MSCOMCT2.ocx")
End Sub
¤G¡B¦Û动²K¥[¤Þ¥Î
²K¥[¤Þ¥Îªº«e题¬O对VB¤uµ{¨ã¦³¾Þ§@权¡A§Y»Ýn¦b§»ªº¦w¥þ设¸m¤¤选¨ú¡§«H¥ô对visual basic项¥Øªº访问¡¨选项¡C¦p¤U图¡G
VBAµ{§Ç¦@¨É¤§¡G±±¥óªº¦Û动ª`册ÉO链±µ库ªº¦Û动¤Þ¥Î
当µM§Ú们¤£¯à§i诉¨C¤@个¥Î户来设¸m这个项¥Ø¡A©Ò¥H这个¤]»Ýn¥Îµ{§Ç¦Û动§¹¦¨¡C
综¦X¤Wz¡A¥H¦Û动¤Þ¥Î¦r¨å对¶Hªº链±µ库为¨Ò¡A¥N码¦p¤U¡G
Sub ¤Þ¥Î¦r¨å对¶H()
Dim myob
On Error Resume Next
Set myob = ActiveWorkbook.VBProject
If Err <> 0 Then ¡¦¦pªGµ{§Ç¥X错
Application.SendKeys "%TMST%V~" ¡¥¥Îµ{§Ç调¥Î§Ö±¶键§¹¦¨选¨ú«H¥ô对visual basic项¥Øªº访问¾Þ§@
End If
ThisWorkbook.VBProject.References.AddFromFile "C:\Windows\System32\scrrun.dll" ¡¦¤Þ¥Î
End Sub
§¹¦¨¥H¤W语¥y¦Z¡A§Ú们¥i¥H§â¥L们©ñ¦bthisworkbook_open¨Æ¥ó¤¤
Private Sub Workbook_Open()
¤Þ¥Î¦r¨å对¶H
ª`册¤é´Á±±¥ó
End Sub
¥ý写这¤\¦h¤F¡A§Æ±æ¯à对¤j®a¦³¥Î
[¦¹贴¤l¤w经³Q§@ªÌ¤_2007-11-19 18:23:30编辑过] |
|