#1
|
|||
|
|||
Displaying pictures from a field with a file path
This is long but I am working with 3 different programs and I will be adding Excel to the mix soon, so here it goes. I have created a frontend Access 2010 database with an SQL backend (MySQL 2005) in an office environment stored on a server (Server 2003). My knowledge level isn't high on visual basic but I can do a lot of basic stuff and calculations. I have a hyperlink form field in Access where someone can go get a picture and it will display a thumbnail and in VB it renames the picture and saves it in a directory folder I created, then it stores the new file path in a text field (Photo1). All of the form data goes into a table that I use as my data source in Word. I need to have this picture go into a Word doc, all the merge fields which work great, except for this picture. It comes in and states "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location." I have created various VB for this field and tweaked the field itself and nothing seems to work. Right now I have the field in a table and structured like this:
{INCLUDEPICTURE "{MERGEFIELD\"Photo1\"}.jpg" \d \*MERGEFORMAT } I also tried adding just {MERGEFIELD Photo1 } and then putting VB in to run when the doc opened but it didn't work (See below). Code:
Private Sub AssemblyMeeting_Open() Dim Table As Table Dim Cell As Cell FileName = Cell.Range.Text Dim FileName As String Dim strCell As String Set Table = ActiveDocument.Tables(1) Set PicCell = ActiveDocument.Range(Start:=Table.Cell(1, 1).Range _ .Start, End:=Table.Cell(1, 2).Range.End) For Each Cell In Table.Range.Cells strCell = FileName If FileName = "" Then Cell.Value = "" Else With Cell.Range .Delete .InlineShapes.AddPicture FileName:=FileName, LinkToFile:=False, SaveWithDocument:=True .InlineShapes.AddPicture FileName:=PicCell, LinkToFile:=False, SaveWithDocument:=True End With End If Next End Sub Last edited by macropod; 07-28-2012 at 01:52 AM. Reason: Added Code Tags & Formatting |
Tags |
mail merge problem, pictures |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
File Path for Outlook 2007 pst | eliz.bell | Outlook | 2 | 10-29-2011 07:04 PM |
Displaying contact pictures in e-mail header | christer | Office | 0 | 10-03-2011 09:40 AM |
Modify default template to include file path | jacl | Excel | 1 | 03-26-2011 10:24 AM |
Show Full File Path in Title Bar | paulj | Excel | 3 | 02-10-2010 07:18 AM |
get file name without Path | Ziggy1 | Word VBA | 1 | 09-29-2006 07:55 PM |