Solved

about getobject

Posted on 1998-02-18
7
791 Views
Last Modified: 2012-05-04
What wrong I did:
1. in Win95, click at file c:\myfile.txt, Notepad actived with myfile.txt appeared. That means .txt is registed and the automation interface is OK.
2. excuted code
   dim act as object
   set act = getobject("c:\myfile.txt")
and got "not find file..." error.
0
Comment
Question by:learn
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1457386
I doubt it is doable to do OLE Automation with Notepad.  I tried this, and it didn't work, but when I replaced it with a word document, it worked fine.  Why do you want to do automation on a text file?
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 40 total points
ID: 1457387
The fact notepad opens myfile.txt doesn't means it has ole interface registered. The myfile is passed as a command line parameter to notepad, and it opens it. You can do the same thing using the Command$ function
0
 

Author Comment

by:learn
ID: 1457388
Hi MikeP,

So what is automation interface, how to know which object has got registed. I just want to learn getobjuct() and failed for both .txt and .doc. Can you help...or an example?

Cheers.
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 6

Expert Comment

by:anthonyc
ID: 1457389
I did set objObject = getobject("c:\windows\desktop\anthony.doc") and it worked fine.. is MS Word on your machine?
0
 

Author Comment

by:learn
ID: 1457390
Hi Anthonyc,

Thank you for your two comments.
As you know now, I just want to learn getobject() since it is under Activex which looks like something new.
My PC hasn't got MS Word but when I click at the .doc file the Wodpad actived...As MikeP said that doesn't mean ole interface registered (Why not say "automation interface registered"?).

Cheers.
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1457391
Wordpad is not OLE automation compatible.. that's why it doesn't work.  

0
 

Author Comment

by:learn
ID: 1457392
Hi Experts,

I have check the OLE automation by puting an OLE control into the form and looking at the property box. There are some classes included in the box: PBrush, Paint.Pecture and others. Hence, I quess those must be registed automation interfaces! So, I tried:
dim act as object
set act = createobject("Paint.Picture")  'or ("PBrush")
but still got error message: Object required:-(
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question