vbscript >> problem in using asp to call word

by Wahodi » Mon, 04 Aug 2003 17:31:10 GMT

I am using asp (vbscript) to open a word file

Set oApp = CreateObject("Word.Application")

Set oDoc = oApp.Documents.Open(TemplatePath
& "\faxTemplate.doc")

in order to paste the data in SQL on the word file

but the following error occurs:

Technical Information (for support personnel)

Error Type:
Microsoft Word (0x800A175D)
Could not open macro storage.
/MailMerge.asp, line 60


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Page:
POST 19 bytes to /MailMerge.asp

please help. thanks.
Wahodi


Similar Threads

1. Save asp webpage as word doc on server using asp and vbscript

Hello,

I am not too sure how to go about this so am looking for a little
help.

I have the webpage user filling in a large form on an asp page which
populates a MySQL database.

I then want to create a word doc using the entered data.

I need to open the asp page in word on the server and save it as a
word doc.

Unfortunately I have no idea how to go about this and heavy internet
searching has found nothing.

Does anyone know how this is done, or can point me in the direction of
a source that will help me with this problem?

Thanks in advance for your help,

Graeme Wood

2. Problem with ActiveDocument when using Word in ASP.Net - Asp.Net

3. Problem with Word and using ActiveDocument in ASP.Net

All,

I'm using a word application in ASP.net (server side) to open an existing 
document, do a 

mail merge on it and then serve the created document to the client.

The problem I am having is when I open the word document using the 
Word.Application  and I 

then try to access the ActiveDocument property I get an error message saying 
that 'This 

command is not available because no document is open. ' 

I have tried the exact same code in Windows forms and it works fine.

The code is;
        Dim wordDoc As Word.Document
        Dim wordApp As New Word.Application

        fileName = "c:\killian.doc"

            '    
----------------------------------------------------------------
        wordDoc = wordApp.Documents.Open(fileName, missing, [readOnly], 
missing, missing, 

missing, missing, missing, missing, missing, missing, isVisible)

        With wordApp.Application
            .ActiveDocument.MailMerge.MainDocumentType = wdFormLetters

The code fails here with the error 'This command is not available because no 
document is 

open. '

I can't figure out why this wont work. Thanks in advance for any help.

Killian

4. Calling Webservice from ASP using httpGet now breaks calls from .Net code - Asp.Net

5. having Word object stuck problem when calling Word editor Close fu

Hi,

I am expressing a strange problem when I call Close method od WordEditor. It 
closes the open email and MS Word blank window stays there and sudden windows 
error message appear that says "Send Error" button and has checkbox to reopen 
the word.
I tried to diagnose this problem and this scenario I came to understand, If 
I enter To address, Subject and just have a focus in word compose window the 
email closes and ms word window stays there and it doesn't stuck anything. 
But just I don't have a focus in that window it always stuck and error comes 
up. 

Below is the code that is written in my Button in compose window:

{ //Start of button click function
HRESULT hr;
       //Get the email if flag for tracking, return boolean
        CString Ret = MailTracked();
       //Write log
        logging.lineStatus ("Tracking option "+Ret);
             if(Ret == "no")
            {
                     //Send email normally.
                     mailItem->Send ();                       
            }
            else
            {
              //*Cancel= true;
              //Don't send open email, send it using the Send method later.
              *Cancel = VARIANT_TRUE;
              CComPtr<Outlook::_Inspector > spInspect; 
              m_spApp->ActiveInspector (&spInspect);
              CComPtr<IDispatch >dif; 
              spInspect->get_CurrentItem( &dif);

              //Manipulate the mail item and send it manully in this function
              Write_SentItemsData(dif);
              dif=NULL;
 
             //Check the type of editor open
             enum Outlook::OlEditorType EditorType;
             spInspect->get_EditorType (&EditorType);

             //This code is written to put the focus in word window forcely 
before sending the email. The working window handle is get and SendWindow 
SET_Focus to do this. but not working...
             HWND hwnd;
             hwnd = ::GetForegroundWindow();           
             HRESULT hr = EnumChildWindows(hwnd, &EnumWindowsProc, NULL);

                     if(EditorType==olEditorText)
                     {
                            spInspect->Close (olDiscard);
                     }else
                     if(EditorType==olEditorRTF)
                     {
                            spInspect->Close (olDiscard);
                      }else
                      if(EditorType==olEditorHTML)                           
                     
                      {
                           spInspect->Close (olDiscard);
                       }
                      else if(EditorType==olEditorWord)
                       {
                              //spInspect->Close (olDiscard);  
                              //          AfxMessageBox("Word");
                          CComPtr<IDispatch >Dispatch;
                          spInspect->get_WordEditor((IDispatch**)&Dispatch);
                          DISPID dispp;
                          OLECHAR FAR* szMemberpName;
                          VARIANTARG pResult;
                          EXCEPINFO pexcep;
                          UINT uArgErr;
                          DISPPARAMS disparams={NULL,NULL,0,0};
                          disparams.cArgs =1;
                          disparams.cNamedArgs=0;
                          disparams.rgdispidNamedArgs =NULL;
                          disparams.rgvarg =new VARIANTARG[1];
                          disparams.rgvarg [0].vt =VT_I4;
                          disparams.rgvarg [0].lVal = 0;
                          //szMemberpName = L"Application";

                          //Call the WordEditor object Close to close the 
open word window
                          szMemberpName = L"Close";
                          VARIANTARG ApResult;
                          Dispatch->GetIDsOfNames (IID_NULL, &szMemberpName, 
1, LOCALE_SYSTEM_DEFAULT, &dispp);
                           hr = Dispatch->Invoke(dispp, IID_NULL, 
LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD, &disparams, &ApResult, &pexcep, 
&uArgErr);           
                           if(FAILED(hr))
                           {
                                  _bstr_t des;
                                  char * ii;
                                  des = pexcep.bstrDescription;
                                  ii = (char*) des;
                                  logging.lineStatus ("Application method 
fail");
                            }
                            else
                            {
                            
                             }//End Close of WordEditor call

                     } //End Word Editor
           }//End Send Email manually
}//End Function


When the Close method is called and code is return the open email does close 
but it stuck the WINWORD and window error message appear.

Is there any alternate or better way doing this? I need this very urgently, 
any help please.

Thanks you,
Irfan 

6. Problems with word XP and VB6.0 (calling Word in VB) - Visual Basic/VB

7. How to Call Word Macro in ASP.NET

Requirement: Call a Word Macro from ASP.NET with parameters

Do anyone have idea about this? Please notice the import statement and
sample code, as I am a beginner using ASP.NET, thanks for your kindly
reply!

8. Calling MS Word from an VB.NET ASP Application - VB.Net