快速插入unit test results的图片对象

by terry 25. November 2009 10:28

昨天在给unit test results贴图时,发现要插入一个图片对象时,要点击很多次按钮才能插入一个对象,

如果要插入很多图片的话,太麻烦了.

我想能不能用word的宏来简化操作,昨晚经过多次尝试,已经能够一键插入多个对象,这样就提高了大家以后的效率.

现在分享给大家.

Step 1

 

Step 2

InsertImageObject

 

Step 3 选择键盘,按下快捷键

 

Step 4

在编辑器中插入以下代码,保存.

Code

Sub InsertObject()

 

    Dim imageFilePath As String

    Dim imageFileName As String

    Dim countSelected As Integer

    Dim index As Integer

    Dim lengthSplit As Integer

    Dim pathSplit() As String

    Dim fopen As FileDialog

    Dim items As FileDialogSelectedItems

   

    Set fopen = Application.FileDialog(msoFileDialogFilePicker)

    fopen.Show

    If fopen.SelectedItems(1) = "" Then

        Exit Sub

    Else

        Set items = fopen.SelectedItems

        Set fopen = Nothing

    End If

   

    countSelected = items.Count

   

    For index = 1 To countSelected

         imageFilePath = items(index)

         pathSplit = Strings.Split(imageFilePath, "\")

         lengthSplit = UBound(pathSplit)

          imageFileName = pathSplit(lengthSplit)

        Selection.InlineShapes.AddOLEObject ClassType:="htmlfile", FileName:= _

            imageFilePath, LinkToFile:=False, DisplayAsIcon:=True, _

            IconFileName:="C:\Program Files\Internet Explorer\iexplore.exe", _

            IconIndex:=10, IconLabel:=imageFileName

    Next

End Sub

以后在按下CTRL + Y,选择要插入的图片(可多选),就能够一次插入多个图片对象了.

大家有什么修改意见,请留言.

Tags:

Email2Blog

Comments

11/25/2009 10:44:31 AM #

GOOD

GOOD

GOOD | Reply

11/25/2009 10:44:52 AM #

hy

不錯

hy | Reply

11/25/2009 10:46:18 AM #

Bob

不能直接Ctrl + c -> Ctrl + v 吗?

Bob | Reply

11/25/2009 8:47:13 PM #

terry

肯定不行的啦

terry | Reply

11/28/2009 4:28:05 PM #

Donald

Donald | Reply

11/30/2009 10:33:38 AM #

shelly

不错!

shelly | Reply

6/29/2010 6:42:06 PM #

wow gold

gee

wow gold | Reply

1/30/2012 1:43:44 AM #

logo design brisbane

Can I just say, this blog is what got me through the day today.  Every time I read it, I just get more and more excited about whats next.  Very refreshing blog and very refreshing ideas.  Im glad that I came across this when I did.  I love what youve got to say and the way you say it.

logo design brisbane | Reply

1/30/2012 9:06:45 PM #

clear skin max

Ive been meaning to read this and just never got a chance.  Its an issue that Im very interested in, I just started reading and Im glad I did.  Youre a great blogger, one of the best that Ive seen.  This blog definitely has some information on topic that I just wasnt aware of.  Thanks for bringing this stuff to light.

clear skin max | Reply

2/1/2012 11:16:39 PM #

brazilian butt lift dvd

Fantastic blog!  I dont think Ive seen all the angles of this subject the way youve pointed them out.  Youre a true star, a rock star man.  Youve got so much to say and know so much about the subject that I think you should just teach a class about it...HaHa!

brazilian butt lift dvd | Reply

2/2/2012 2:47:44 PM #

overmantle mirrors

I dont know what to say.  This blog is fantastic.  Thats not really a really huge statement, but its all I could come up with after reading this.  You know so much about this subject.  So much so that you made me want to learn more about it.  Your blog is my stepping stone, my friend.  Thanks for the heads up on this subject.

overmantle mirrors | Reply

2/8/2012 6:07:06 AM #

Catering

Good luck getting people behind this one.  Though you make some VERY fascinating points, youre going to have to do more than bring up a few things that may be different than what weve already heard.  What are trying to say here?  What do you want us to think?  It seems like you cant really get behind a unique thought.  Anyway, thats just my opinion.

Catering | Reply

Add comment


(Will show your Gravatar icon)

biuquote
  • Comment
  • Preview
Loading



Copyright © 2009 APJ Software

最新评论

Comment RSS

公告

欢迎使用APJ Blog!

日历

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar