Solved

about getobject

Posted on 1998-02-18
7
794 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 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