- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 7# icestormer
¬°¤è«K¾\Äý¡A¯S±N¥¦Â½Ä¶¦p¤U¡G- Actually it's a member of msforms library, not from native vba.
- (½T¹ê¥¦¬O·L³nªí³æµ{¦¡®wªº¤Aû¡A¦Ó«D VBA ªº¥Í¦¨¤¸¥ó)
- you can use it without a userform but you'll need a reference
- to Microsoft Forms Object Library. The reference is automatically added
- to a workbook when you insert a Userform from VBeditor's Insert menu.
- (§A¥i¥H¤£»Ýªí³æ¦Ó¥h¨Ï¥Î¥¦¡A¦ý¬O§AÁÙ¬O¶·n°Ñ¦Ò¨ì·L³nªºªí³æª«¥óµ{¦¡®w¡C
- ·í§A±qVB½s¿è´¡¤J¿ï³æ¤º´¡¤J¤@±iªí³æ®É¡A¦¹°Ñ¦Ò¶µ·|¦Û°Ê¥[¤J¨ì¬¡¶Ã¯¸Ì¡C)
- Problem (°ÝÃD)
- An Excel VBA subroutine that involves interaction with the Windows Clipboard fails to run with the error:
- ¡§Compile error: User-defined type not defined.¡¨ The line of code highlighted by Excel as
- being the cause of the error includes a reference to the ¡§DataObject¡¨ object type.
- (·í¤@Ó¸Õºâªí VBA µ{¦¡¬q¤º²[»\µøµ¡°Å¶K蠟Ãìµ²©ó°õ¦æ®É²£¥Í¿ù»~¡G"µ{¦¡½s¿è¿ù»~¡G¨Ï¥ÎªÌ¦Ûq«¬ºA©|¥¼©w¸q"¡C
- ¤Ï¥Õ¼Ð¥Üµo¥Í¿ù»~ªº³o¦æ¬O¦b»¡©ú¥¦¦b°Ñ·Ó "¸ê®Æª«¥ó (¡§DataObject¡¨)" ®Éµo¥Í¤F°Ñ·Ó¿ù»~¡C)
- Solution (¸Ñ¨M¤è®×)
- (Tested on my machine with Excel 2003 SP3) (¤w¸g¦bExcel 2003 SP3´ú¸Õ¹L)
- In the Microsoft Visual Basic editor: (¦b·L³nªº VB ½s¿è¾¹¤º)
- Stop debugging by clicking the ¡§Stop¡¨ button on the toolbar (if debugging isn't already stopped).
- (°±¤î°»¿ù¼Ò¦¡¡A§Y¿ï«ö¤u§@¦C¤Wªº "°±¤î" ¶s²×¤î°»¿ù)
- Tools menu | References (¤u¨ãµæ³æ | °Ñ¦Ò¶µ¥Ø )
- In the list of available references, find ¡§Microsoft Forms 2.0 Object Library¡¨, check it, and click OK.
- ¦b°Ñ¦Ò¦C¥Ü¶µ¥Ø¿ï³æ¤º¡A§ä´M¡§Microsoft Forms 2.0 Object Library¡¨¡A§ä¨ì«áÂI¿ï¥¦´N§¹¦¨¤F¡C
- (For me, this was the 2nd unchecked item from the top of the list; it wasn't sorted alphabetically
- in the list like most of the rest of the listed items.)
- Run the macro again. (¦A«·s°õ¦æ¥¨¶°)
- That's it! Hope this helps! (´N³o¼Ë¡I §Æ±æ¹ï§A¦³©ÒÀ°§U¡I)
½Æ»s¥N½X |
|