Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-27-2012, 06:52 AM
okiegirl okiegirl is offline Displaying pictures from a field with a file path Windows 7 32bit Displaying pictures from a field with a file path Office 2010 32bit
Novice
Displaying pictures from a field with a file path
 
Join Date: Jul 2012
Posts: 4
okiegirl is on a distinguished road
Cool 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
The file path will change everytime the Word document is generated so I can't just save a picture in it, I need it to reference the field that displays the file path. Any help would be great! Thank You!

Last edited by macropod; 07-28-2012 at 01:52 AM. Reason: Added Code Tags & Formatting
Reply With Quote
 

Tags
mail merge problem, pictures



Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying pictures from a field with a file path 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
Displaying pictures from a field with a file path get file name without Path Ziggy1 Word VBA 1 09-29-2006 07:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft