Hi
Hope this is the right forum for this
This is my scenario:
The user decides what kind of document he wants to create.
The document is created by the application and stored on the server.
Since I dont know how to store the document directly on to the clients machine, I'm storing it on the server.
Now comes the tricky part:
In order to open the document I normally use a vb script.
But since I want to open the document in my code and store it locally at the users computer.
I have been trying with this code
Private Sub Document
< code for creating the document and storing it on the server >
Dim script As String
script = "<script language=""vbscript"">" & vbCrLf
script &= " Dim Word" & vbCrLf
script &= " Dim Doc" & vbCrLf
script &= " Sub VisDok() " & vbCrLf
script &= " Word = CreateObject(""Word.Application"") " & vbCrLf
script &= " Doc = CreateObject(""Word.Document"") " & vbCrLf
script &= " Word.Visible = True" & vbCrLf
'script &= " Doc = Word.Documents.Open('" & sDokNavn & "')" & vbCrLf
script &= " Doc = Word.Documents.Open("" \\server\Dokument\2005\fp64486.doc "")" & vbCrLf
script &= " Doc.SaveAs(""c:\test.doc"")" & vbCrLf
script &= " End Sub" & vbCrLf
script &= "</script>" & vbCrLf
Me.Page.RegisterStartupScript("Open", script)
End Sub
Am I way off here or can somthing like this be done?
The reason why I'm trying to do it this way is this.
When the document is first created, its path(on the server) is stored in the db.
But if opening and storing the document is succesfull, I want to store the loacal path in the db.
So that the user can open the document thats stored locally later.
Hope this wasnt to confusing?
I know the script works fine as a normal script in the html-code, but when I try it in my vb.net code somthing is wrong!
Hope this is the right forum for this
This is my scenario:
The user decides what kind of document he wants to create.
The document is created by the application and stored on the server.
Since I dont know how to store the document directly on to the clients machine, I'm storing it on the server.
Now comes the tricky part:
In order to open the document I normally use a vb script.
But since I want to open the document in my code and store it locally at the users computer.
I have been trying with this code
Private Sub Document
< code for creating the document and storing it on the server >
Dim script As String
script = "<script language=""vbscript"">" & vbCrLf
script &= " Dim Word" & vbCrLf
script &= " Dim Doc" & vbCrLf
script &= " Sub VisDok() " & vbCrLf
script &= " Word = CreateObject(""Word.Application"") " & vbCrLf
script &= " Doc = CreateObject(""Word.Document"") " & vbCrLf
script &= " Word.Visible = True" & vbCrLf
'script &= " Doc = Word.Documents.Open('" & sDokNavn & "')" & vbCrLf
script &= " Doc = Word.Documents.Open("" \\server\Dokument\2005\fp64486.doc "")" & vbCrLf
script &= " Doc.SaveAs(""c:\test.doc"")" & vbCrLf
script &= " End Sub" & vbCrLf
script &= "</script>" & vbCrLf
Me.Page.RegisterStartupScript("Open", script)
End Sub
Am I way off here or can somthing like this be done?
The reason why I'm trying to do it this way is this.
When the document is first created, its path(on the server) is stored in the db.
But if opening and storing the document is succesfull, I want to store the loacal path in the db.
So that the user can open the document thats stored locally later.
Hope this wasnt to confusing?
I know the script works fine as a normal script in the html-code, but when I try it in my vb.net code somthing is wrong!