I have an Access 2007 Database in which a particular form runs a lot of Office Automation. In a certain table, there is a file path stored to an image location (e.g. "C:\myfolder\myimage1.bmp"
.) From a form, I open a certain Excel document, which will contain many ActiveX Image Controls. I already have all Excel references in the Access form's VBA. I can get the document open, but everything I have tried or researched to use the path to dynamically create the image in Excel fails. My first ActiveX image control is named "Image1". How can I update the Picture property from Access so the picture will show? Variations of the code below I have tried.
Dim excelApp As Excel.Application
Set excelApp = CreateObject("Excel.Application")
excelApp.DisplayAlerts = False
excelApp.Visible = True
Dim WB As Excel.Workbook
Set WB = excelApp.Workbooks.Open("\\192.168.200.11\Advisor CRM\PFS\PFS Graph Book.xlsx")
WB.Worksheets("Program Summary - IRE").Shapes.OLEObjects("Image1").Object.Picture = LoadPicture(DLookup("[ImagePath]", "CompanyProducts", "[Company] = 'Allianz'"))