Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Database -> Word

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,33726
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Database -> Word
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Database -> Word - 4/20/2006 11:09:20 AM   
  flex

 

Posts: 6
Score: 0
Joined: 4/20/2006
Status: offline
IE VB Script MS Access -> Word

-----------------------------------------------------------

Is this possible? I have a word template that has I need filled in by a database that resides on a server. I have a website in wich people come on and fill out forms. That information is stored on a database. Now I want to be able to goto those completed forms on the website, click on a link and it should open up a word template on my computer and fill in the fields. Is this possible? No .NET.

THank you guys in advance!!
 
 
Post #: 1
 
 RE: Database -> Word - 4/20/2006 7:47:50 PM   
  centrino

 

Posts: 16
Score: 0
Joined: 9/4/2005
Status: offline
Everything is possible! SQL Database?

(in reply to flex)
 
 
Post #: 2
 
 RE: Database -> Word - 4/20/2006 9:13:22 PM   
  L12

 

Posts: 22
Score: 0
Joined: 1/19/2006
Status: offline
It may be worth looking at using Response.ContentType. The guy in this post has an example of how he uses it with MS Access:

http://www.codeave.com/asp/code.asp?u_log=129


(in reply to centrino)
 
 
Post #: 3
 
 RE: Database -> Word - 4/21/2006 5:11:57 AM   
  flex

 

Posts: 6
Score: 0
Joined: 4/20/2006
Status: offline
centrino
Its an access database.

L12
I don't think Response.ContentType. will work becuase I need to fill in the blanks in a template in MS WORD.  I don't belive you can do it this way.  Please correct me if I'm wrong.

I have some bookmarks on my Word file that I need replaced.  I can do this with VBScript right now, but I can't get data from the Database.

The script is under <SCRIPT VBSCRIPT>  How can I conned to a DB under this?  I can connect to DB using ASP, but the code for word wont' work in asp.

Thank for the response! Please HELP!

(in reply to L12)
 
 
Post #: 4
 
 RE: Database -> Word - 4/21/2006 5:21:07 AM   
  flex

 

Posts: 6
Score: 0
Joined: 4/20/2006
Status: offline
Ok, I dunno if I confused u guys, but here ist he code that i have right now.  This code opens up word and opens up a template and replaces the bookmarks with words that i've specified.  Wat I need to happen is I need to get the words I input off a database.

<script language='VBScript'>

Sub StartWord()
Dim Xcl
Dim strTemplPath
Dim objWord
Dim objDoc
strTemplPath = "C:\WdAcc95\"
'Start Word and create a new doc from the template
Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Add(strTemplPath & "WordTemplate.dot", False, 0)

'Insert the variables' contents into the bookmarks in Word
With objDoc
     .Bookmarks("txtCompany").Range.Text = strCoName
     .Bookmarks("txtSalutation").Range.Text = "Salutation"
     .Bookmarks("txtFirstName").Range.Text = "FirstName"
     .Bookmarks("txtLastName").Range.Text = "LastName"
     .Bookmarks("txtAddress").Range.Text = "Address"
     .Bookmarks("txtPostalCode").Range.Text = "PostalCode"
     .Bookmarks("txtCity").Range.Text = "City"
     .Bookmarks("txtCountry").Range.Text = "Country"
End With

end Sub
</script>

So how do I connect to the DB and pass the value? HELP!!!  Oh this is a ASP page by the way.

< Message edited by flex -- 4/21/2006 5:26:27 AM >

(in reply to flex)
 
 
Post #: 5
 
 RE: Database -> Word - 4/21/2006 5:26:31 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
As long as you have rights to the DB, you can open a connection to it and manipulate the data however you want. Just google for "VBScript database connection".

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to flex)
 
 
Post #: 6
 
 RE: Database -> Word - 4/21/2006 5:41:02 AM   
  flex

 

Posts: 6
Score: 0
Joined: 4/20/2006
Status: offline
Hmm... my code is under <SCRIPT> tags... the DB connection will work only under <%   right?

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Database -> Word - 4/21/2006 5:45:27 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
Well, it depends. If it is in <Script> tags then it is running as client code. If the user has rights to the DB and would be able to connect to it as themselves then it wouldn't make any difference.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to flex)
 
 
Post #: 8
 
 RE: Database -> Word - 4/21/2006 5:52:39 AM   
  flex

 

Posts: 6
Score: 0
Joined: 4/20/2006
Status: offline
OK.  I only need this to work for admins. SO not everyon getting on teh webpage will be doing this.  This only needs to work on couple computers.  So you are saying if I can set up permission on the server for my database, I'll be able to connect to the database @ some location from my house? If so How do I set the premissions and how can I do this?

(in reply to ebgreen)
 
 
Post #: 9
 
 RE: Database -> Word - 4/21/2006 6:13:34 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
I'm not sure about the DB/Network admin side of things.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to flex)
 
 
Post #: 10
 
 RE: Database -> Word - 4/21/2006 5:05:52 PM   
  flex

 

Posts: 6
Score: 0
Joined: 4/20/2006
Status: offline
Ok, then how would you do it .. if the database resided on a local drive.  IF anythign I can map the drive.

(in reply to ebgreen)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Database -> Word Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts