Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing a screen shot into a Table

Status
Not open for further replies.

tbiceps

IS-IT--Management
Nov 23, 2005
106
US
I want to create a user-friendly command button that will enable a user to import a screen shot into a table field record. Currently, if you right click on the correct cell, the option Insert Object dialog box will open with the various choices associated with the activity. Will any of these methods work: DoCmd.TransferText(), or DoCmd.TransferSpreadsheet(), or DoCmd.RunCommand acCmdExport.
 
are you wanting to store the actual image or just the address of the image? If its possible for you to do just the address I would suggest that you do that. It would reduce the size of your database.


-Pete
 
That would be ideal, however, my instructions request that I embed the image within the database.
 
The code listed below supposedly will accomplish my initial post, however, when I attempt to run the code I get a compile error at run-time.

Compile error:
User-defined type not defined

"Dim Objs As OLEObjects," this line of code is the problem error. Do I need to reference a library?


Option Explicit
'Attribute VB_Name = "ObjectLinkingAndEmbedding"

Public Sub AddOle()
' Create a reference to the current objects.
Dim Objs As OLEObjects
Set Objs = Sheet3.OLEObjects

' Add a new object.
Objs.Add Filename:=ThisWorkbook.Path + "\Cuckoo.wav", _
Link:=False, Top:=20, Left:=40, _
IconLabel:="The Cuckoo Sound"
End Sub

Public Sub AddOLE2()
' Create the worksheet reference.
Dim WS As Worksheet
Set WS = Worksheets(3)

' Add a new object.
WS.Shapes.AddOLEObject _
Filename:=ThisWorkbook.Path + "\Cuckoo.wav", _
Link:=False, Top:=20, Left:=40, _
IconLabel:="The Cuckoo Sound"
End Sub
 
That code is Excel VBA, not Access VBA.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How could I modify code in way that I could apply to Access VBA?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top