Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Insert an image into a word 2007 document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
spnz - 18 Sep 2006 12:10 GMT
Hi there,

Does anyone have an example piece of code that inserts a .bmp file into a
word document from a selected folder location?

Any help would be really helpful.

Thanks in advance!
Zkonker - 18 Sep 2006 15:16 GMT
> Hi there,
>
> Does anyone have an example piece of code that inserts a .bmp file into a
> word document from a selected folder location?

I don't normally offer too much advice here, as the MVP's examples are
much more professional, but since I don't see a reply so far...

Sub paste_pic_1()
'
'
Dim i As Integer

Application.FileSearch.LookIn = "C:\Your_sub_here"
Application.FileSearch.FileName = "*.bmp"
Application.FileSearch.Execute

For i = 1 To Application.FileSearch.FoundFiles.Count
   Selection.InlineShapes.AddPicture
FileName:=Application.FileSearch.FoundFiles.Item(i)
   ActiveDocument.InlineShapes(i).LockAspectRatio = msoTrue
   ActiveDocument.InlineShapes(i).Height = 180#
   ActiveDocument.InlineShapes(i).Width = 239.75
   Selection.InsertBefore (Application.FileSearch.FoundFiles.Item(i))
   Next i
   
   
End Sub
Cindy M. - 19 Sep 2006 12:26 GMT
Hi Zkonker,

> For i = 1 To Application.FileSearch.

FileSearch has been removed from Office 2007 because the
"search" functionality is now considered to be an operation
of the OS (Vista).

You'd need to rework your example to use the old DIR
command to have it work in 2007.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.