472,129 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,129 software developers and data experts.

How to create and open Word document in Network PC with VB.NET

Hi,

I created application that store the data in SQL SERVER that reside on
network. The client also use this application to access the resources
provided with application. But is the client want to register new customer or
companies they will enter the information in Windows Form and the program
automaticaly creates the WORD document under specific folder under
application path. Once the empty word file created than ask user if they want
to open it or not.

Everythings works fine under the application path. Now my boss ask me to
install the application another 3 computers. The problem is each client going
to get application path and if one of them trys to view any customer using
windows form they will not going to open a word document if the file is
created another user machine.

So I thought its a best way to achive this to create a shared folder that
has 2 partition only disk that also SQL Server reside.

Say example the the PC name is SQLSERVER2006000 and the has one hard drive
with 2 partition. C Drive and D Drive.

In the D Drive I created Shared Folder call MSCUSTDOCUMENT and this folder I
have another 2 folders as CUSTDOC and COMPDOC. With this each folder contains
word document that belong to either cutomer or companies. The word document
named after the customer ID such as cust00000008.doc under the CUSTDOC and
say comp00000004.doc under the COMPDOC folder.

My problem is that I can create empty word document (It copies empty
temp.doc into application path/CUSTDOC/ and rename it such as
cust00000008.doc) in every client machine and now I want to change the code
that every client can do the same but instead of using app path they will
have to access to network PC that I desribe in above. Unfortunetly I don't
know how to use VB.NET to achive network file copies (creation) and open.

Because once the document is created in the program View Customer client
have to view the cutomer information and they can use the btnOpen to open the
word document (it is in network PC) to view much detail information about the
customer.

Well I am sorry for my English but that what I am looking to achive:

Current File Copies into ApplicationPath ++++++++++++++++++++++++++++++
'GET THE TEMP DOCUMENT PATH
Dim pathName_TEMP_DOCUMENT As String =
"\MUSDOCUMENT\SDSTP_TEMPLATE\Temp.doc"
Dim fullPath_TEMP_DOCUMENT As String

fullPath_TEMP_DOCUMENT =
Path.GetFullPath(System.Windows.Forms.Application. StartupPath & "\..")
fullPath_TEMP_DOCUMENT = fullPath_TEMP_DOCUMENT &
pathName_TEMP_DOCUMENT


'GET THE DESTINATION PATH
Dim pathName_NEW_DOCUMENT As String = "\MUSDOCUMENT\MUST\" & myNewDoc
Dim fullPath_NEW_DOCUMENT As String

fullPath_NEW_DOCUMENT =
Path.GetFullPath(System.Windows.Forms.Application. StartupPath & "\..")
fullPath_NEW_DOCUMENT = fullPath_NEW_DOCUMENT & pathName_NEW_DOCUMENT


'COPY THE FILE
File.Copy(fullPath_TEMP_DOCUMENT, fullPath_NEW_DOCUMENT, True)

'Check if the file created successfuly
Dim FileSystemObject1 As Object
FileSystemObject1 = CreateObject("Scripting.FileSystemObject")
If (FileSystemObject1.FileExists(fullPath_TEMP_DOCUME NT)) Then
fileCreated = True
Else
fileCreated = False
End If
Now I want every client machine to use similar code to copy the Temp.doc
from network shared folder into appropriet destination agin in Netowrk shard
folder.

Then will ask user user if they want to open the Word Document. the word
document will open using windows forms that I coded before that has only Save
and exit menus.

The current word document opnes as:
strFileName = clsDOCLOCATION._mDOCUMENT
Dim mShowCurrentCustomer As String = ""
mShowCurrentCustomer = Me.Text & " SHOWING THE MS WORD DOCUMENT for
CUSTOMER " & clsDataHolder._mMUSNO

Me.Text = mShowCurrentCustomer
Me.Refresh()

'If the user does not cancel, open the document
If strFileName.Length Then
oDocument = Nothing
AxWebBrowser1.Navigate2(strFileName)
End If
I am sorry for long post but I try to ask very clearly what I am looking for
and I hope someone will help me to achive the things that I am looking for.

Thank you very much for reading my post.

Rgds,
GC

Aug 11 '06 #1
0 3041

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ronny Sigo | last post: by
3 posts views Thread by Andy Davis | last post: by
3 posts views Thread by Michael Tkachev | last post: by
3 posts views Thread by sloesch | last post: by
7 posts views Thread by Peter | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.