I have a report generated by my access program. Each record in the report has a picture that is stored externally and referenced with a file path. I want to have a way for my users to copy the pictures so they can paste them into an email or document. Since the pictures are stored externally the copy function is not available from the right click context menu. Is there a way I can add in a button and use VBA to get the picture from the file path and place it in the clipboard?
问题:
回答1:
You can try the steps detailed in http://support.microsoft.com/kb/210216 however from the same description of the article:
"Microsoft Access does not have a command that sends information to the Clipboard. To post information to the Clipboard, you need to define a Visual Basic for Applications function that calls several Microsoft Windows API functions. This article shows you how to create a function that copies text to the Clipboard. "
so if this answers yur question deppends on how comfy you are on creating functions and using APIs
回答2:
Well I figured out a decent work around. I found some code here http://access.mvps.org/access/api/api0042.htm. Since this code is intended to be used in a form I put a button in the report that opens a form and passes in the filepath of the image. Once the form is open it sets the image control to the passed in filepath. Then it executes the copy function and closes itself. This seems to work pretty well.
回答3:
You could add something like this to the Double-Click event for the image:
Shell "RunDLL32.exe C:\Windows\System32\Shimgvw.dll,ImageView_Fullscreen " _
& Me.FullPathtoImage
this will open it in the Windows Picture and Fax Viewer from where the user can copy and so on.