Solved

about getobject

Posted on 1998-02-18
7
789 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
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 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…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now