vb中创建CAD TOOLBAR出错,请高手指点
本帖最后由 作者 于 2006-9-16 2:01:38 编辑 <br /><br /> <P>CAD原代码</P><P>Private Sub AddToolbar()<BR> ' This example creates a new toolbar called TestToolbar and inserts a<BR> ' toolbar button into it. The toolbar is then displayed.<BR> ' To remove the toolbar after execution of this macro, use the Customize Menu<BR> ' option from the Tools menu.<BR> <BR> Dim currMenuGroup As AcadMenuGroup<BR> Set currMenuGroup = acadDoc.Application.MenuGroups.Item(0) '调试后此行出错<BR> <BR> ' Create the new toolbar<BR> Dim newToolBar As AcadToolbar<BR> Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")<BR> <BR> ' Add a button to the new toolbar<BR> Dim newButton As AcadToolbarItem<BR> Dim openMacro As String<BR> <BR> ' Assign the macro string the VB equivalent of "ESC ESC _open "<BR> openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)<BR> <BR> Set newButton = newToolBar.AddToolbarButton("", "NewButton", "Open a file.", openMacro)<BR> <BR> ' Display the toolbar<BR> newToolBar.Visible = True</P>
<P>End Sub</P>
<P>在VB中运行后 提示 :</P>
<P>实时错误 ‘91’</P>
<P>对象变量或with块变量未设置</P>
<P>Set currMenuGroup = acadDoc.Application.MenuGroups.Item(0) '调试后此行出错<BR></P>
<P>问题已解决 谢谢</P>
<P>问题已解决 谢谢</P>
<P>问题已解决 谢谢</P>
<P>问题已解决 谢谢</P>
<P>问题已解决 谢谢</P> 把acadDoc改为 thisdrawing 试试 <P>晕~~~ 是在VB6.0里面啊 不是VBA</P>
<P>mccad 在吗?能指点一下吗?</P>
页:
[1]