+ -
当前位置:首页 → 问答吧 → 用加载宏向工作表中添加logo

用加载宏向工作表中添加logo

时间:2011-08-09

来源:互联网

想写个加载宏,其中有个功能需要将本地的一个logo图片保存在加载宏中,然后使用该功能,就可以把logo加入到工作表的指定位置。
因为工作环境不能上网,所以必须把图片保存在宏中,不知道能否实现,感谢先。

作者: hbpaopao   发布时间: 2011-08-09

请上传相关附件,不然没办法下手

作者: xtanuihazfh   发布时间: 2011-08-09

在网出差,网络太烂,附件上传不了……
兄弟可以随便找张图片就好,只要能实现以下功能就好,给个大概的样子,剩下的我可以自己摸索。
图片是保存在加载宏文件中的,然后借用了别人的代码,打开后在excel菜单栏新加了一栏。
[copy]
Sub auto_open()
Call addbutton
End Sub
Sub addbutton()
    Dim ctlEdit As CommandBarPopup
    Dim ctlRegEx As CommandBarButton
With Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControlPopup, Before:=11)
        .Caption = "DIY"
    End With
        Set ctlEdit = Application.CommandBars(1).Controls("DIY")
        Set ctlRegEx = ctlEdit.Controls.Add(msoControlButton)
        With ctlRegEx
            .Caption = "加logo"
            .OnAction = "logo"
            .BeginGroup = True
            .Visible = True
            .Enabled = True
        End With
End Sub
sub logo()
end sub
[/copy]
现在的要求就是在sub logo()中加一段代码,然后我以后使用此功能的时候,他可以在当前工作表把logo图片加进入,不用老是自己去找。

作者: hbpaopao   发布时间: 2011-08-09

相关阅读 更多