Results 1 to 2 of 2
  1. #1
    jondavidf is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    57

    VBA Code to reference Form Image

    Is it possible to call an image from an access form using VBA code?



    I have a database that exports data into an excel file with several worksheets. I have gotten almost everything to work correctly with the database and reports (thanks Rod!) except one thing.

    I haven't yet figured out how to insert a picture into the header of each worksheet that is currently embedded in one of the forms.


    • The form name is frmLogoForm and the image name is imgLogoImage.


    I currently have the report correctly inserting text into the left header with the following code:

    Dim WS As Worksheet
    For Each WS In Worksheets
    WS.PageSetup.LeftHeader = "Text Test"
    Next WS

    This does put the "Text Test" text into the header of each worksheet, however, I would really like to have an image there, not just text. I have seen examples where the image is called from a file on a hard drive but then if I move the picture file or database the link will be broken. My rationale is that if the image is embedded in a form in the database then it will stay with the database wherever it may be moved to. Any thoughts?

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    well you might have to resort to the default help mechanism. do it in excel and record it. look at the code and translate to access. but see, if it's actually embedded into the form itself in access, the metadata associated with it might make a transfer impossible.

    have you tried literally selecting it in the form, copying it to the clipboard and pasting it to other programs (including the excel sheet) to see what it does and how it changes?

    testing, even ridiculous testing methods that seem pointless, is sometimes how you can learn workarounds that turn out to be useful for life!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-10-2011, 10:58 AM
  2. Reference to a query from a form does not work
    By giladweil in forum Access
    Replies: 3
    Last Post: 02-28-2011, 06:38 AM
  3. Control Reference on a Form
    By gmitchell@exbrief.com in forum Forms
    Replies: 5
    Last Post: 01-24-2011, 12:31 PM
  4. form/subform reference problem
    By dbertanjoli in forum Forms
    Replies: 1
    Last Post: 01-10-2011, 03:31 PM
  5. Form Name Reference in VBA
    By Simon Sweet in forum Programming
    Replies: 0
    Last Post: 05-22-2008, 01:55 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums