Solved

Problem creating ActiveX object from network drive

Posted on 2003-11-17
9
641 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
[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
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
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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

707 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