Word automation using asp and VBA

kalees's Avatar, Join Date: Aug 2006
Go4Expert Member
Hi,
i am having problem with word automation. my code is working fine in my local system.but when i deployed the code and resigerted the dll also into the terminal server it is not working. i am using word2003 professional but terminal server contains word2003 standard. please anyone help me.
This is my dll coding,
Code:
Option Explicit 
    Private mwrdApp As Word.Application 'Holds Word instance 


    Private Sub Class_Initialize () 
      Set mwrdApp = New Word.Application 'Create Word instance 
    End Sub 


    Private Sub Class_Terminate () 
      mwrdApp.Quit 'Kill Word instance 
      Set mwrdApp = Nothing 'Kill reference 
    End Sub 


    Public Function GetWord () As Word.Application 
      Set GetWord = mwrdApp 'Return Word instance 
    End Function
This is my asp coding,

Code:
 <%
    Set WordServer = Server.CreateObject("Test.Wordserver")
    Set objWordobject = WordServer.GetWord 'Get Word instance

     objWordobject.Visible = True

   strTemplate="c:\template.dot"
  'Open doc
          Set objDocobject=objWordobject.Documents.add(strTemplate)

%>

Last edited by shabbir; 20Sep2006 at 14:47.. Reason: Code formating.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
When you use Word.Application by adding a reference to word application the compiled code becomes tightly coupled with the version of the word used and the client also should have the same version. Either you need to compile the code on the client machine or use the same version when writing the code.

I had the same problem with MS Outlook with version 9 and 10 conflict and the last thing I wanted to do is downgrade my office from XP to 2000 and I had to do that for the successful running of my application.
0
kalees's Avatar, Join Date: Aug 2006
Go4Expert Member
hi shabbir,

Thanks for your wonderful reply.
If so then how can i create a generalized dll for my application?

according to you, all my clients who are running my application should have same version in their system that my server has right?

please advice me.


Thanks,
Kalees
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Yes thats true. Or if you are unsure of the client version as to what he might be running use the different dlls and have an installer to detect the office version and copy the correct dll. You may even need to use InstallShield instead of the default dll setup utility.
0
kalees's Avatar, Join Date: Aug 2006
Go4Expert Member
Hi Shabbir,
Thanks once again.

Can you briefly explain about the installer or InstallShield? how to create it and use it?
I have a doubt on word automation, suppose one client might use my application that time whether the dll open the server word document or client's pc word document?

Please guide me.because i have to deliver this very soon.



Thanks,
Kalees
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by kalees
Can you briefly explain about the installer or InstallShield? how to create it and use it?
http://www.macrovision.com/products/...ld/index.shtml
Quote:
Originally Posted by kalees
I have a doubt on word automation, suppose one client might use my application that time whether the dll open the server word document or client's pc word document?
The best option for fast delivery would be to have multiple dll's for each version of word and load the particular dll for the specific version found on the system
0
kalees's Avatar, Join Date: Aug 2006
Go4Expert Member
Hi shabbir,
Thanks for the reply.

But i tested word automation like this,
i installed the dll and asp page into the another system and open the page from my system like this

http://192...(ip address of the another system)/virtualdirectory of the another system/asppage.asp

but the word document is opening in the another system not in my system.

My requirement is opening a word document from a server and user can save it in to their pc. please kindly advise.




Thanks,
Kalees
0
kalees's Avatar, Join Date: Aug 2006
Go4Expert Member
Hi Shabbir,

How to download a word document from a server automatically and save it to the client system?
Before the download, i have to open the file and change some content in the server.

Thanks,
Kalees
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Are you asking how to allow download of a word document. Just place a link to the word doc and clicking will download on the client machine.
0
kalees's Avatar, Join Date: Aug 2006
Go4Expert Member
Hi Shabbir,

Thanks for the reply.

how to allow download of a word document from server automatically?
consider this situation,

one user use my application and fill up some information over the form and he want to take copy of it. here we reteirve all the values from the form and replaces with these values over the word template already we have on the server. Finally we allow to download as word document.

do you understand the requirement?


Thanks,
Kalees