Solved

Problem creating ActiveX object from network drive

Posted on 2003-11-17
9
598 Views
Last Modified: 2008-02-01
I'm trying to open a new WORD document using a VB script in a .html file.

function boe(wordfile)
            Dim objWord                          
            Set objWord = CreateObject("Word.Application")
            objWord.Visible = true
            objWord.Documents.add(wordfile)
end function

This works fine if I launch the .html file from a local drive but as soon as I launch the file from a network drive it gives the error message "Active-X component can't create object: 'Word.Application'"

Any thoughts?

0
Comment
Question by:camjai
9 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9764185
On the same machine?

If on the other, do you load word on that machine?
0
 

Author Comment

by:camjai
ID: 9764402
Yes on the same machine. Works fine if I run it from c: but gives the error message when I run it from a networkdrive.
0
 
LVL 9

Expert Comment

by:_ys_
ID: 9766249
Is MS Word installed on the local machine - the machine trying to access the html page across the network?

Sounds like it's not.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Expert Comment

by:UriS
ID: 9766684
The system has some problems creating objects and running applications from network drives.
Very often the solution is to run the application/register the component and create it from:
1. a local drive.
2. (your option) from a mapped drive.
I suppose you know how to map network drives, but if you don't I'll be happy to help you with it.

anyway, it worked for me.
0
 

Author Comment

by:camjai
ID: 9769564
I have Word installed on my local machine. I can create new documents and open word documents both from local drives as from a drive on my company network. In my opinion Word works fine.

I'm not sure I've made the problem clear. I have the script in a .html file on my local drive c:. If i run it with Internet Explorer it will prompt me if I want to create an ActiveX object and then it will fire up Word and open  a new document. This is what I want to happen.

When I copy the .html file to a network drive (I'm still on the same machine, same session and I have full access to all files and folders on this drive) and I run the same .html file from this location in Internet Explorer it doesnt work and gives the error message 'Can't create ActiveX component'.

It's not just creating word objects that's the problem btw. There's a create object command in many VB scripts (for file manipulation for instance) and they also work fine locally but not from a network drive.

> Set objWord = CreateObject("Word.Application")

Uris: I don't think mapping drives is the answer here but if you still think it is then I'd like to know what to do.

I've read a bit on Creating objects on the MSDN. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vafctcreateobject.asp)
>You can create an object on a remote networked computer by passing the name of the computer to >the servername argument of CreateObject. That name is the same as the Machine Name portion of a >share name: for a share named "\\MyServer\Public," servername is "MyServer."
>Note:   Refer to COM documentation (see Microsoft Developer Network) for additional information on >making an application visible on a remote networked computer. You may have to add a registry key >or your application.

I've also tried adding the server name but i think its the 'note' that's my problem. I cant find the COM documentation but I think this is my problem.

thanks for reading all this :)
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9770510
I've create the following html and test and has no problem


<html>

<head>

</head>
<script language=vbscript>
function boe()
          Dim objWord                      
          Set objWord = CreateObject("Word.Application")
          objWord.Visible = true
         
end function
</script>
<body>
<input type="button" name="but" onclick=boe()>
</body>

</html>


you may want to post some more code
0
 

Accepted Solution

by:
camjai earned 0 total points
ID: 9770519
Problem Solved...

it turned out to be the Internet Explorer security settings that differ for local scripts and scripts that go through the network. Can't believe I didnt think of that.

I'll split the points between you anyway for the help.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
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…
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…

747 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

11 Experts available now in Live!

Get 1:1 Help Now