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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Placing a file into a variable of the Object type

Status
Not open for further replies.

aidenryan

Programmer
May 18, 2001
14
0
0
CA
Does anyone know how to put the contents of a file into a variable of type Object?
ie.

Dim obj As Object

Set obj = ??????("c:\myfile.dat")

 
Why do you want to do this?

How do you want to use the file?

My experience with this type of thing has been to build objects for office apps (like Excel) but you need to use file types that VB knows and understands.
 
Yes, this can in principle be done under certain circumstances - but I'd need to know more about your requirements before suggesting a specific solution.
 


Hi aidenryan

Are you looking for 'FileSystemObject' or is this something more complex?


Stew


 
To do this, you would need to create an object that offers you an abstraction of the file. It is that object that you would set your pointer to. This object could be the FileSystemObject, or it could be whatever you wanted it to be. You can not, however, simply set an object directly to a file path and expect it to be the file. - Jeff Marler B-)
 
I've taken a look at the FileSystemObject approach....however, the file in question is a .bmp. Any further suggestions?
 
if it's a bitmap then you just need to use LoadPicture:

Dim obj as object ' preferably, Dim obj as StdPicture

set obj=LoadPicture("myfile.bmp")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top