Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

about getobject

Posted on 1998-02-18
7
Medium Priority
?
796 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 80 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
Technology Partners: 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 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