Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Change Template Of Doc Without Open Winword


I need to change the linked template of a Worddocument without having to open the document in Winword. CAn someone please help me out ??




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MDI Form-open Application (i.e WinWord)
Does anyone know the command that opens an application for example
WinWord.exe?

I want to make an MDI form that will open existing applications (.exe)
without "break" them.


Thanks in advance,
Whoever has an answer to that please reply-it may be too easy but I haven't found it yet!

How To Detect An Open Program(e G WINWORD)
Hi there!!!!


Could anybody give me a tip on how can i identify a running program(e.g winword; games) using visual basic? and how to close it safely? your help would be appreciated a lot. Thanks

Text File Opening In Notepad Want To Open In Winword
Anyone

I've created a file in note pad
basically i want to open that same file in winword
How do i do it ?

Open "s.txt" for input as #1
Do until EOF(1)
Line Input #1, TMP$
Loop
Tmp$ = Tmp$ + vbcrlf$
CLose #1

Regds
Sam F

Open Template
Hi everyone,

I'm trying to open a new document based on a template that I created from VB6.
My template is in the 'User Templates' folder for MS Word.
The only way I was able to do that is by creating a dummy doc based on my template, opening that doc, then opening AttachedTemplate, closing dummy doc. This kind of works, but there's got to be a shorter way to open the template.

Thanks for your help.

Open Template In VB6
Hi

I have a template named BLANK.xlt and what i am hoping to do, is, when i run my app, i would like my template to appear on screen everytime the app is opened, but, at the moment I am struggling on how i can do this.

When the app, and template is opened, the user will (hopefully) be able to add items into the cells of my template and once finished, save the edited template as their new document.

Can anyone please give me advice on how i can achieve this

Many many thanks in advance

Change Template Of Word Document
Hello How can i change de word template to normal.dot with a visual basic script, because it are a lot of files. I would like to use a program that can run while word is not started up en that i can give a directroy to the program what must change can some one help me??

I Want To Open An Excel Template?
I know that if I have a command button in the following:


Code:
Private Sub Command2_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Activate
xlSheet.Application.Visible = True
Exit Sub
End Sub
Then I'll have a brand new Excel spreadsheet to transfer over data.
I have two questions.

1.) How can I pull up a template instead of a whole new document?

2.) How can I pull up a certain file instead of a new document?

Thanks for any help!

I appreciate it!

Sincerely

Open Word Template
Is there a way to open a word template, make some changes...search and replace changes and then prompt the user to save the template as some other document?

Open Normal Template In Vb6
Ok...when you open visual basic editor in word will open you a NORMAL project himself. how do i open this NORMAL project in vb6 or where is this project for proggraming the normal template of word

TNX

Template Doesnt Open :(
I'm trying to write a template...Now I've followed the steps as described on:
http://www.fontstuff.com/vba/vbatut09c.htm and saved it all as document template. But if I open the document template, nothing happens (the vba form doesnt appear)..what am i doing wrong ? plz see attachment

How To Open Word Template?
I need to open a word template when a user hits the button. Then i need to add info to the document and save it as a different name.

Not sure how to specifically open a template.

Open As Template, Save As Doc
Hi there,
If I open a document as a template, et template.dot but then save it with a unique name, eg. word1.doc then how do I close all instances of word?

Cheers,
Padraic.

Open Template In The Excel
Hi

How do I open the template from Excel using VB ?

How Change Word Template Without Opening Document
Hello, I have thousands of documents that contain the location of a the original template on a server that is now decommisioned. this is resulting in delays when opening the docs. is there any way to automate a template change without having to go into each document?

Thanks
Nick

How To Open A Specific Word Template.
Hi, I'm trying to cut my programming teeth on a little side project at work.

Situation: I want to be able to call up a specific MS Word template from within an Access database. I modified some code that I found on this site and can at least get Word to open a blank document marked "read only" but not the specific document I want.

Here is the code so far:

Private Sub OpenWord()
Dim WordApp As Word.Application
Dim WordTemp As Word.Template
Dim STRTempName As String
STRTempName = "\fltntshr001ITG_CommonIT ServiceeFDNDealer AlertsDealer System Alert.dot"
Set WordApp = New Word.Application
Set WordTemp = WordApp.Documents.Open(STRTempName)
WordApp.Visible = True
End Sub

Thank you to the original author and thanks greatly for any help in advance to you all.

Open MS Word Document/template Through VB6
Hi all, I am writing the following code to open a word template

Code:Dim objWord As Word.Application


Set objWord = New Word.Application
objWord.Visible = True
objWord.Documents.Open App.Path & "WordDotFile.dot", , , True, , "password"

The word template is password protected. This code does open the template file from VB6 but code macros of the template does not run. While I try to run the template directly, a vba form opens in the start up but when I open it through VB6 it does not evokes the form. Any guidance please...

Help - Need To Open And Read A Word Template From VB
Hi !!!

I have a Word Template file ( *.dot). which will have a text box and check box taking user input. i have to open that *.dot file and read the values given in the text box and check box and insert the values in to the db.how should i do it from VB.please help me in solving this problem.

Open A New Document Read-only Template
I am opening a new document on my own customized template from my vb program and everytime i close it it asks me if i want to save changes to the document and to the template.how do i make the template readonly so that it doesnt ask me if i want to save changes to it?

here's my code:

Dim doc As String
Dim temp As String

temp = App.Path & "Gael.dot"
doc = App.Path & "Doiciméad 1.doc"
Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.Documents.Add
wdApp.Visible = True
wdApp.ActiveDocument.AttachedTemplate = temp
wdApp.ActiveDocument.SaveAs FileName:=doc

Open Outlook MailItem Using Email Template
I have found I think all I need to open a new email message in Outlook but I would like it to open using a template we have created.

Any help on this?
Thanks

Open Template If File Doesn't Exist
What I'm doing is I have a macro that opens a template, copies data over, and then does a 'save as' as the person's initials and closes that template.

What I would like to do is something like this:
In a specific folder, if there is an excel spreadsheet with that person's name, open that, copy data and save and close.
If that file does not exist, then use the template.

What I have so far does only the template, it doesn't look for the other excel file. Here is the code I have so far:


Code:
Location = "C:Engineer Progress Reports"
togetherness = Location & thefilename
Worksheets("Sheet1").Range("I4:M65536").Copy
Workbooks.Open ("P:projectdb emplate.xls")
Workbooks("template.xls").Activate
Worksheets("Sheet1").Activate
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("A1:E65532")

ActiveWorkbook.SaveAs Filename:=togetherness, FileFormat:=xlNormal

ActiveWorkbook.Close
ThisWorkbook.Activate

Thanks for the help.

Open A Word Template Save And Close
Hello,

I have some problem here figuring this out, , the plan is to open a template word file, write some data, SaveAs with new filename then close it. this code has some problem with it.



Set wdQE = New Word.Application
If UCase(cbxReportTemplate.Text) = "RIFFA" Then
wdQE.Documents.add (App.Path & " emplatesEnquiryRiffa.dot")
Else
wdQE.Documents.add (App.Path & " emplatesenquiry.dot")
End If

Call create_QEDoc(flvwsuppliers.TextMatrix(flvwsuppliers.Row, 1), flvwsuppliers.Row)


Dim oDoc As Document

Set oDoc = wdQE
oDoc.SaveAs "C:ProcEmailAttach" & txtRFname & ".doc"
oDoc.Saved = True
oDoc.Close


thanks in advance...

Open A MS-Word Template And Replace Some Text
I got some code of how to open MS word within VB6, that's ok, but my question is, once I had that doc or template which is what i want ( a template), open, what do I have to do to update the template with the info. retreived from a data-base?........

Open Word Template, Create New Document
How do i open a word template and create a new document from it?

There's like 20 parameters when opening a word.application
.documents.open(,,,,,,...... Mark P.
www.cafecartel.com
Providing Low Cost Powerful Point of Sale Solutions.

Template Open Events And Copying Worksheet Code
Hi all, 2 questions

1) What events are fired when a Template is opened? Is it possible to have some code execute when a template is opened? I'm looking to automatically run a macro every time someone opens a particular template file and figured the best way was through a workbook or worksheet event of some kind. Suggestions?

2) The template has some code in the worksheet that I need to copy to each new worksheet the macro creates. How do I access/copy the existing worksheet code to another worksheet? Or if I were to copy the worksheet itselt does the code come with it?

Thanks!
-Matt

VB6, Open An Existing Excel Template For Editing From Code, Help
Dear all.

I need to open Excel templates from my VB app.

I am using the following code

Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
xlApp.Visible = True
xlApp.Workbooks.Open MyFilename 'MyFilename is always an .xlt file

My problem is that Excel opens a new workbook file based on
the template 'MyFileName' and enumerates it with a 1.

So if the file I want to open is 'test.xlt' - Excel opens a new workbook called 'test1' based on the template.

Is there a way to just open the the template file for editing ?

Please please help

Many thanks

GT

Blocking Template After Exporting From Access 2002 To A Word Template
I am having some difficulty determining the appropriate code for stopping a template from popping up after I close the document to which my Access data has been transferred to. My VB code automatically saves the document, but when I quit Word, my original template pops up. Whatever code I insert into VBE doesn't seem to stop it. I hope someone can help me.... Here's the relevant portion of the code below:

'Creates a Word instance to use for the 8D form. Uses the existing
'Word instance if there is one; otherwise, creates a new instance.
Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
'Word isn't running; creating a Word object.
Set objWord = CreateObject("Word.Application")
Err.Clear
End If

On Error GoTo Command126_ClickError

strDocsPath = "V:QCProblem Cases" & ""
strSaveName = "BWA CAR No. " & Me![Customer Tracking Number] & ".doc"
strSaveNamePath = strDocsPath & strSaveName
strTemplatePath = "V:QCProblem Cases" & ""
strWordTemplate = strTemplatePath & "8Dform.dot"

'Check for existence of template in template folder,
'and exit if not found
strTestFile = Nz(Dir(strWordTemplate))
If strTestFile = "" Then
MsgBox strWordTemplate & " template not found; can't create 8D form"
Exit Sub
End If

Set objDocs = objWord.Documents
objDocs.Add strWordTemplate
.
.( I have removed the section which relates fields between Access and the template...there's nothing that controls opening and closing of the document)
.
.
With objWord
.Visible = True
.Selection.WholeStory
.Selection.Fields.Update
Debug.Print "Going to save as " & strSaveName
.ActiveDocument.SaveAs strSaveName
.Activate
.Selection.EndKey Unit:=wdStory
End With

Command126_ClickExit:
Exit Sub

Command126_ClickError:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume Command126_ClickExit

End Sub

I would appreciate if I receive a reply ASAP (job-related!!)

How To Paste On A Word Template Without Loosing The Formatting Of The Template?
I'm new on VB please help me!
I have to fill some special word template with informations caming from an access DB.
Here the code I'm using now.

Private Sub SearchAndReplaceOnce(monDocWord As Word.Document, strTagARemplacer As String)

Dim maPlage As Variant
Set maPlage = monDocWord.Content

With maPlage.Find
.ClearFormatting
.Execute FindText:=strTagARemplacer
If .found = True Then maPlage.Paste
End With
End Sub

All this code is working but the method Paste is replacing also the formatting that I have pre-defined on the word template.
How can I do to avoid this problem?
Thanks

Word Object To Save Template As A Template.
I use a word object to open a template and resave it to template.
The reason I'm opening the template is that I want to run a macro that fills the template with data from bookmarks.

I use this code:

Code:
Dim objWordApp As Object
Set objWordApp = CreateObject("Word.Application")
objWordApp.Documents.Add Template:=TemplatePath, NewTemplate:=True
objWordApp.ActiveDocument.LoadMe sConn, FunctionId, sFunctionType, SupplierId
objWordApp.ActiveDocument.SaveAs FileName:=WorkPath & FileName
objWordApp.ActiveDocument.Close SaveChanges:=wdSaveChanges

But when opening the new template I get this annoying reference to the old template. The old macros doesn't save in the new template.

When running save as in word on a template the macros are transferred to the new file without referencing to the old macro.

How do you do this in VB?

Open A Document Word From A Template Of Word
Hello, I'm working in Visual Basic 6 and I want open a document word. But this document must be from a template of word (its name is Informe).

I do it with the code
Dim objWord As Word.Application
Dim objDoc As Word.Document

Set objWord = New Word.Application
Set objDoc = objWord.Documents.Add("C:Informe.dot")

It's ok but I only see the document, I want to see the menus of word,....
If it isn't possible can you send me the code to print this document?


Thank's and sorry for my poor english

ADO And Winword
I want to know if it is possible to use ADO to "push" data from an Access 2000 database. I have a command button in a form within the database which when executed will move the information from the form to a winword document. I am currently using DDE to do this which has been successful but have recently have integrated Word 2002 into the working environment and when trying to execute this procedure it produces an error in access: "The other application in the DDE conversation, isn't responding in the time specified by the OLE/DDE timeout setting."

Any ideas?

Winword
When i use this Shell statement to open word from a database it opens correctly but as a full window, is there a way i can have it open slightly minimized i.e not full window.

Shell "C:Program FilesMicrosoft OfficeofficeWinword.exe", 1

OLE And Winword.exe
Does any one have any example code for opening a word templete, pushing something out to a bookmark and then printing?

OLE And Winword.exe
Does any one have any example code for opening a word templete, pushing something out to a bookmark and then printing?

Where Is The Winword.exe !??
Hi, friends !

Do anybody could help me with this problem?

I developed a program that use a shell to call a ms-word formatted document.

To call the ms-word is very easy, once when I know the path it's located, but when I run the program in another computer that this file is not in default path... my problems begin.

Maybe there is a way to automactly find out the path....
But I have no idea how to use such mechanism.

Thank's all that could help.

Export To Winword Doc
can I have Export data from Database including pics to word doc from vb?

Make Winword Go Away :-(
My very first VB 6.0 project (have a little VBA and C++ experience). I use the following code to open Word from VB:
' create document in Word by [OLE] Automation.
' create a word doc and save it with a new name.
objWordDoc = CreateObject("Word.Application")
objWordDoc.Visible = False
objWordDoc.Documents.Add

I add lines to the doc in the program; everything seems to work OK. I run the code then look at the Word doc via Word (opened from my Ofc97 toolbar). The doc is there and the lines I’ve added are in it.

My problem is: while testing repeatedly, eventually I run out of space on my PC for basic stuff like printing, opening programs, etc. When I look at the Close list (I get when I do a Ctrl-Alt, Delete) I see many-many copies of Winword active and have to close each one of them separately or restart my system to free things up.

My question is: how do I close the Winword activity from within my VB program? My word object is called: objWordDoc. I’ve tried objWordDoc.close, objWordDoc.delete, delete objWordDoc in the code, none of which do what I want. I do do an ActiveDocument.Save and .Close at the end for the document itself, but apparently that’s not enough.

It’s obvious I’m a novice (but I’m having lots of fun w/VB ). What am I missing? Thanks, Mark

Compare In Winword
Dear All,
There is Compare option in winword between two docuemnts.Is it able to appy this method between two
rich text boxes(As You all know that ROBDOG888 has a Spell Check by using Winword)

Thanks in Advance

3 Questions For Winword
Hello Anyone

1. I would like on each page the same header to be printed
e.g when seen on 1st page = "SAM"
when seen on 2nd page = "SAM"

2. How can i draw a table with borders in
winword thru VB? the table should be as long as the page.

3. Automatically Page Break to display at the end of the page

thanks in advance

regds

samf

Must KILL Winword.exe
Hi!!!

My Windows NT Task Manager is driving me crazy. Using VB, how can I end Winword.exe application from my "Processes" tab? The "Processes" tab doesn't recognize the word "Quit". "Applications" tab does not show that the application is running at all.

Please tell me what to do if you can!

Thank you!

Must KILL Winword.exe
Hi!!!

My Windows NT Task Manager is driving me crazy. Using VB, how can I end Winword.exe application from my "Processes" tab? The "Processes" tab doesn't recognize the word "Quit". "Applications" tab does not show that the application is running at all.

Please tell me what to do if you can!

Thank you!

Winword Addins
In MsWord app How to prevent a user from unloading a Template ?

Thanks

Winword.exe Path
hi,
can anyone help me find the path for the winword.exe, i have this hardcoded way...

Shell "C:Program FilesMicrosoft OfficeOfficeWINWORD.EXE "




Thanks in advance

joan

WinWord Doc For Reporting
Hi fellow developers,

Have anyone done reporting by generating a winword document filled with graphs etc ?

Basically, I'm required to generate a set of reports complete with Graphs, Histograms, Tables, Texts, Simple Box diagrams and output these in a Winword document.

A winword template have been drafted but I'm not able to find a way of putting together all the details into the document and have it generated as a winword document via vb.

The user will be able to preview the document and by clicking on "Save" will produce a report in winword document. I've tried OLE Automation but that only generates a standard text DOC file. How do you put pictures, tables, graphs into winword via vb ???

Any help with this would be helpful. Is this possible in the first place?

Thanks. Hope to hear from you all soon.

Close WinWord Process
Hello.

How can I close winword.exe (taskmanager) from VB ?

thanks.

Packaging And Reqmt For WinWord?
I'm a newbie with vb but here's my question. I am packaging a program that I have ole'd to a word doc which I am including in the package. When I package the program it says I need WinWord. That's a big 10-meg file and the program I'm making is going to be downloaded. Do I really need to include WinWord if the person who will be downloading the program has Word already on their system? Thank you for any help you can offer.

Word Count In Winword
Hi,
I am using the following code to count the following code to count the number of word in active document.

VB Code:
MsgBox ActiveDocument.Words.Count


But the problem is that I am getting the wrong output.
For example if I check from word menu it shows as 65 and command gives as 75.I Dont know how it happen.Can some one help me.Is is possible to call the word count macro??

Opening Winword Through Vb Code
i know i can use the shell cmd but how will i know where his office is installed or even where his windows is installed i suppose the are some system variables i can use but i dont no how to use them.

help please

How Can I Shut Winword Down Programmatically?
I made an app that copies the contents of a .doc file and populates an OLE object with it. Everything works great the first time around but when I try to run the app a 2nd time I get errors telling me that a font is too big and that I'm low on system resources. When I look in the task manager winword.exe is still running. If I close it manually via the task manager everything works great again. Is there a way for me to shut down winword.exe even though I haven't opened Word as an object?

Here is the code that I'm using.

Option Explicit
Private mvarVisualFileString As String

Private Sub Form_Click()
OLE1.Close
Unload Me
Set frmVisuals = Nothing
End Sub

Private Sub Form_Load()

Timer1.Enabled = True
OLE1.Visible = False
OLE1.AutoActivate = vbOLEActivateManual
OLE1.Class = "Word.Document.10" 'depends on what's installed on your system
OLE1.CreateEmbed mvarVisualFileString 'mystringhere
OLE1.DoVerb vbOLEUIActivate
OLE1.AutoVerbMenu = False
OLE1.AutoActivate = False
OLE1.Visible = True

End Sub

Public Property Let VisualFileString(ByVal vData As String)
mvarVisualFileString = vData
End Property

Any help is appreciated

2 Questions Relative To WMI And Winword
Hallo!
1 – My application has to start winword and show a report. I set there for a reference to Microsoft Word 10.0 Library. It is working pretty well, but just if the user has office 10 or winword 10.0 installed. I would like to refer to other library that a user that runs office 97 can also use the application.
Which one can I use and where to found it. I have already unfortunately tried the following libraries:
- Office compatible 1.0 Object Library
- Microsoft Office Runtime 1.0 Type Library

2 - Using WMI (Windows Management Instrumentation) I’m getting hardware info with my application. This is also work well, except the network adapter info on win nt. I know that I have to first install the WMI core, and I did it. I get the latest version here. All the others WMI based functions are working on win nt. Do u have an idea how can I get the network adapter info on win nt?

thx for helping

james

Copyright © 2005-08 www.BigResource.com, All rights reserved