Word automation using asp and VBA

Discussion in 'ASP' started by kalees, Sep 20, 2006.

  1. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    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 a moderator: Sep 20, 2006
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     
  3. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     
  5. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    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. :confused:



    Thanks,
    Kalees
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    http://www.macrovision.com/products/flexnet_installshield/installshield/index.shtml
    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
     
  7. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  8. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  9. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     
  10. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  11. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
  12. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    hi Shabbir,
    Thanks for the reply.

    Can we allow download a word doc from server to client system using the VBA?


    Thanks,
    Kalees
     
  13. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Probably not but I am not sure. It has to be a server side language to initiate the download.
     
  14. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Hi Shabbir,
    Thanks for the reply.

    can we open a word document in the browser using vba?
    like this,
    Set Docobject=wordobject.documents.add(strTemplate)

    Docobject.Activewindow...............

    please advice me.


    Thanks,
    Kalees
     
  15. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Why not try and see as I dont have the setup and so I am not able to tell you for sure.
     
  16. kalees

    kalees New Member

    Joined:
    Aug 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
  17. splendorsaran

    splendorsaran New Member

    Joined:
    Jan 30, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    hi shabbir

    I need one help in asp and pkease help me out here.

    I want to find the word as a password protected file or not using asp.

    this function i need to uploading a file to the server if it is going to be an password protected file means it shouldn't get upload to the server .

    Thanks
    Muthu
    Saravananmail@gmail.com
     
  18. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    splendorsaran, instead of jumping into an old thread with your query try putting it as a fresh thread for us to see. Also try reading [thread=168]Before you make a query[/thread] thread.
     
  19. urstop

    urstop New Member

    Joined:
    Oct 17, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to use word automation to generate word document with the results from the client side javascript. So is there any work around to disable the Active X warnign I get on the page?

    My requirement is say , I have my page of search results at Appartment for Rent in Hyderabad. I would like to have the option of user saving those results in the word document by clicking on the button. I know that this can be done from the server side and sending back the doc, but wondering to see if I can do it frmo the client side as all the data is already available on the client side
     
    Last edited by a moderator: Oct 17, 2007
  20. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    urstop, Don't jump into any thread with the so called post that links to your site.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice