Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.word.tables
Huber57 Huber57 is offline
external usenet poster
 
Posts: 22
Default Insert image based on filename

All:

Here is what I was looking for. Sorry for the post.

http://www.gmayor.com/mail_merge_graphics.htm

Doug

"Doug Robbins - Word MVP" wrote:

Are you using Excel or Word. Your use of ActiveSheet makes me think you are
working in Excel.

You could however use the information in the first column to do a mail merge
in Word that would insert the filenames and the pictures into a document.

See the "Graphics from data base" item under the "Special merges" section of
fellow MVP Cindy Meister's website at:

http://homepage.swissonline.ch/cindy...r/MergFram.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Huber57" wrote in message
...
Hello all:

I have searched high and low for an answer and I am stumped.

I have a table with two columns. In column A, I have the filename of an
image that I would like to insert into column B. There are over 1,000.
Is
there any way to write a macro to insert all of them into Column B based
on
the information in Column A? I found this macro for excel but I don't
know
if it could be used as a starting point for Word.

Sub ABCD()
Dim pic As Picture
Dim sPath As String, sName As String
Range("B2").Select
sPath = "C:\Graphics\"
sName = Range("A2").Value
If LCase(Right(sName, 4)) ".png" Then
sName = sName & ".png"
End If
If Dir(sPath & sName) "" Then
Set pic = ActiveSheet.Pictures.Insert(sPath & sName)
With Range("B2")
pic.Top = .Top
pic.Left = .Left
End With
Else
MsgBox sPath & sName & " not found"
End If
End Sub

Any help would be greatly appreciated!

Sincerely,

Doug


 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert image does not retain Image quality livetohike Microsoft Word Help 14 November 10th 21 01:20 PM
Insert a Clip Art image on top of an image using Word 2007 Quco Microsoft Word Help 2 June 12th 07 12:05 PM
Can I insert a filename when I insert a picture into word? tpbIII Microsoft Word Help 2 March 13th 06 11:13 AM
Insert > Autotext is missing "filename" and "filename and path"; how to get back? StargateFan New Users 7 February 7th 05 12:17 AM
Switch an image dynamically based on mail merge field - possible? Chris Hlusak Mailmerge 1 January 24th 05 11:11 PM


All times are GMT +1. The time now is 08:48 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"