Asp And Word.Application

I want to know where can found all  word.application command can user in asp, as like Document.Add, Visible = True, Selection.Font.Bold = True, Selection.TypeText, ActiveDocument.SaveAs and blah blah.....
LVL 7
weesiongAsked:
Who is Participating?
 
guyssCommented:
i have the information in a .hlp file

please post your e-mail and i'll mail it to you.
0
 
FRehmanCommented:
interesting question but I think it is not possible on server side
0
 
FRehmanCommented:
I think it will use asp third party component
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
weesiongAuthor Commented:
hi, guyss what is ur email address, my email address = weesiong@rocketmail.com, please post .hlp file to me, thanx!
0
 
guyssCommented:
i just sent it.

some one told me it comes from MS office  but i didn't seem to find it there, anyway just search for the word "Application" and you'll find the object.
0
 
jkvalliCommented:
Hi guyss,
Interested in knowing about the help file. Pl. send the .hlp file to my mail id jkvalli@calsoft.co.in. Thanks.
0
 
makerpCommented:
this creates a word document on the client and puts the body of the HTML page in it.

set myObj = createobject("word.application")
myObj.visible = true
set mydoc = myobj.documents.add
myobj.ActiveDocument.Words(1).Text = document.body.outerHTML  

this might help ... i havnt read the whole thread  
0
 
weesiongAuthor Commented:
hi, guyss, i have open the file u send to me, but it seem no as like .hlp file. can u teach me how to user the file?
0
 
guyssCommented:
it's a .zip file open it to get the .hlp file.
you can download winzip if you need it
at www.tucows.com
0
 
weesiongAuthor Commented:
hi, guyss
i have unzip it, but it is so many js page and few html page, and got .exe file, are you have sent wrong the file?
0
 
weesiongAuthor Commented:
hi, guyss
i have unzip it, but it is so many js page and few html page, and got .exe file, are you have sent wrong the file?
0
 
guyssCommented:
did i send cbawrd.zip ?
this is the correct file,
i has 1 .hlp file in the zip.
0
 
robbertCommented:
The easiest way is to record Word macros and, adopt them.
Also, there is the Word Visual Basic Editor: Menu: Extras | Macros | Visual Basic Editor.
In the VBE, select Menu: Edit | Object Browser, to see all methods and properties. Select an item and press F1 for help.
-- If there are problems converting the macros to VBScript, call back.
0
 
weesiongAuthor Commented:
Hi, guyss, i have got it!
Thanx!
0
 
weesiongAuthor Commented:
Good Man!
0
 
FRehmanCommented:
will you please send me the correct file at leo_faisal@yahoo.com
0
 
guyssCommented:
FRehman, file is on it's way...

JKValli did you get it ???
0
 
jkvalliCommented:
Nice Stuff, I am working on it.
Thanks.
0
 
weesiongAuthor Commented:
guyss can you send the cbawrd.zip to me again, because i've deleted it.
thanx! or anyone who got the files also can send to me please!
0
 
guyssCommented:
on it's way...
0
 
broby425Commented:
Hey guyss, I'd like a copy of the help file too, please.

Thanks!
0
 
ydeewanaCommented:
Guys,

i like to have this file too. My new project is, i have to take data from word document and add it in access. but i was thinking to have word document in ASP form and when i send mail to client.. transfer in MS word version. is it possible?

Please post your comments or email to me at ydeewana@yahoo.com

Thanks,

Yash
0
 
k_murali_kCommented:
Hi, I too need the zip file. Please mail it to me also at kunapareddy@hotpop.com

Thanks
0
 
weesiongAuthor Commented:
Sorry forget bring the file to office, will try remember and upload the file to some place.

Best Regards,
Wee Siong
0
 
weesiongAuthor Commented:
Hi All,

I have sent the help files to you, the file about 3mb, i no sure your mailbox can get these big size mail or not, if cannot get it please let me know. Thanks.

best regards,
Wee Siong
0
 
agg_rohitCommented:
I also need help files.Please send me.

My id is rohita@cressanda.com

Thanks in advance
0
 
prateek_shriCommented:
Please send me the help files too.
my e-mail id: prateek@scanbuy.com

thanks.
0
 
agg_rohitCommented:
when i edit word document through VB it works but not through ASP .Page remains in hanged state. Neither it edits nor it shows any message
0
 
weesiongAuthor Commented:
agg_rohit,

You can try post your code in here, i have try use ASP create the .doc and it work.


Best Regards,
Wee siong
0
 
agg_rohitCommented:
i have created an DLL. when i edit through VB form it works but when doing same thing in ASP it does not.


clsWord.cls
******************************************************
'local variable(s) to hold property value(s)

Private P_Range As Range  'local copy
Public P_FileName As String  'local copy
 Public Property Set MRange(ByVal vData As Range)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Range = Form1
    Set P_Range = vData
    Set vData = Nothing
End Property


Public Property Get MRange() As Range
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Range
    Set MRange = P_Range
   
End Property


Public Property Let FileName(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.FileName = 5
    P_FileName = vData
End Property


Public Property Get FileName() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.FileName
    FileName = P_FileName
End Property


Public Function OpenFile(ReadOnlyMode As Boolean) As Boolean

On Error GoTo ErrorHandler

  If ReadOnlyMode = True Then
 
      Call MobjWordapp.Application.Documents.Open(P_FileName, , True)
      OpenFile = True
      Exit Function
  End If
 
  Call MobjWordapp.Application.Documents.Open(P_FileName, , False)
  OpenFile = True
  Exit Function

ErrorHandler:

MsgBox (Err.Description & Err.Number)

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function
Public Function Save() As Boolean

On Error GoTo ErrorHandler

 
  Call MobjWordapp.Application.Documents(P_FileName).Save
  MobjWordapp.Application.Documents(P_FileName).Saved = True

  Save = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function

Public Function Saveas(SFileName As String) As Boolean


 On Error GoTo ErrorHandler

 
  Call MobjWordapp.Application.Documents(P_FileName).Saveas(SFileName, , , , , , False)
 ' MobjWordapp.Application.ActiveDocument.Saved = True
    MobjWordapp.Application.Documents(SFileName).Close
  Saveas = True
 
  Exit Function
 
ErrorHandler:
MsgBox (Err.Description & Err.Number)
Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function


Public Function CloseFile() As Boolean

On Error GoTo ErrorHandler

 
  Call MobjWordapp.Application.Documents(P_FileName).Close

   CloseFile = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function
Public Function CreateFile() As Boolean

On Error GoTo ErrorHandler
 Dim MobjDoc As Word.Document
 
   Set MobjDoc = MobjWordapp.Application.Documents.Add
   
   MobjDoc.Saveas (P_FileName)
   
   Set MobjDoc = Nothing

   CreateFile = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)
Set MobjDoc = Nothing

End Function
Public Function SetWordRange() As Boolean

On Error GoTo ErrorHandler
    Set MRange = MobjWordapp.ActiveDocument.Content
     
    With MRange
        .Start = 0
        .End = MobjWordapp.ActiveDocument.Characters.Count
    End With
    SetWordRange = True
   
   Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function
Public Function InsertAtStart(Data As String) As Boolean

On Error GoTo ErrorHandler
 
 Call SetWordRange
 
   P_Range.InsertBefore (Data)

   InsertAtStart = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)
Set MobjDoc = Nothing

End Function


Public Function InsertAtEnd(Data As String) As Boolean

On Error GoTo ErrorHandler
 
 Call SetWordRange
 
   P_Range.InsertAfter (Data)

   InsertAtEnd = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)
Set MobjDoc = Nothing

End Function
***************************************************

modcommon.bas
********************************************************
'Public P_FileName As String 'local copy
       
Public MobjWordapp As Word.Application
     
'Public MobjWordDocument  As Word.Document

Public Sub Main()
   
    With App
            .StartLogging "C:\CslWord.Log", 2
            'LogMode = 2 should be the same as vbLogToFile,
            'but vbLogToFile constant is not defined as shown
            'in books online.
           
            .LogEvent "Specified Path File Logging " & Now, vbLogEventTypeInformation
            .LogEvent .LogPath
            .LogEvent .LogMode
End With

    Set MobjWordapp = CreateObject("Word.Application")
       
End Sub

***********************************************************

frm1.frm
**********************************************************
Private Sub Command1_Click()
Dim x As New clsWord
x.FileName = "c:\1.doc"
x.OpenFile (True)
x.InsertAtStart ("Hi x")
x.InsertAtEnd ("Bye x")
x.Saveas ("c:\2.doc")
Set x = Nothing
End Sub

In ASP
*******************************************************
 <%
 Dim x,FileName,tempFile,strStart,strEnd
 set x=server.CreateObject("cslWord.clsWord")
 x.FileName = "c:\1.doc"
 x.OpenFile (True)
 x.InsertAtStart ("Hi x")
 x.InsertAtEnd ("Bye x")
 x.Saveas ("c:\2.doc")
 Set x = Nothing
 %>

my email ID is agg_rohit@yahoo.com

if you have yahoo messenger then i am online


thanks for your response
0
 
weesiongAuthor Commented:
agg_rohit,

Make sure you have permission to create the DOC.
0
 
agg_rohitCommented:
i am opening 1.doc into readonly mode and then edit and then save it as 2.doc into writable mode.

if it can work through form then why not from web.
what have you done ,can you send me your code through zip files so that i can run and see them.

0
 
agg_rohitCommented:
i am opening 1.doc into readonly mode and then edit and then save it as 2.doc into writable mode.

if it can work through form then why not from web.
what have you done ,can you send me your code through zip files so that i can run and see them.

0
 
agg_rohitCommented:

i am opening 1.doc into readonly mode and then edit and then save it as 2.doc into writable mode.

it is working fine through VB form but gives following errors through web.

Error       Application C:\CslWord.Log: Thread ID: 1308 ,Logged: Could not open macro storage.5981
Error       Application C:\CslWord.Log: Thread ID: 1308 ,Logged: Could not open macro storage.5981
Error       Application C:\CslWord.Log: Thread ID: 1308 ,Logged: Object variable or With block variable not set91
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.