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




Word Document And RTB


Hi!

Is it possible to load Word document into the RTB without control/special characters so it would be readable?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Opening Word Document From Excel When The Word Document Is Read Only
I'm trying to open a Word document from Excel and have hit a snag. The file I'm trying to access is Read-only and the code stops when the "This file is read-only..." prompt displays. How do I get past this? Here's the code that I have so far (thanks to some help from this forum):

Code:
Sub OpenAndPrint()
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim stPathName As String

stPathName = Range("B4").Hyperlinks(1).Address

If Dir(stPathName) <> "" Then
Set wdApp = New Word.Application
wdApp.Visible = True
wdApp.DisplayAlerts = wdAlertsNone 'Tried to turn off the prompt, but it didn't work.
Set wdDoc = wdApp.Documents.Open(stPathName) 'Code stops here and waits for the user to respond to the prompt.
Set wdDoc = Nothing
Set wdApp = Nothing
Else
MsgBox "The file does not exist!", vbInformation
End If

End Sub

MS Word 2000: Closing Forms In A Document From Another Document With Code
I have a project, in which I use a global template to manipulate different other templates. In those templates there are Userforms built in to gather information to use in a MailMerge. The problem I'm having is that I want only to hide the forms in the templates themselves, and close them in the global template when the whole application is closed. The trouble is that I can't find a way to access the open forms from the global template. Can anybody help me?

Merging/Importing Word, Excel, Powerpoint And Visio Files Into A Word Document
Does anyone know how to do this or know of a website that has source code that does this? I can't find anything anywhere.

Each Page/Worksheet/Slide goes on a seperate page. Print formatting is retained (landscape/portrait) and if the imported Page/Worksheet/Slide is larger than the page im merging/importing to, it should auto-resize to fit the page.

Thx.

Reading The Word Document From Visual Basic Without Opening The Word Applicaiton
Hi

I need to access the word document from visual basic without opening the word application. I can do this by opening the word application. Is there any other way to read a document from vb.

I need to search for a particular word in the document without opening the word application.

Waiting for your reply,

thanks

Mohan

Accessing Word Document 'header/footer' Via Word Object Library
Hi All

As the title suggests really, I can access everything I need on a Word document opened via the Word Library object but I can't find how I access the headers and footers of a docuemnt

Many Thanks
Steve

Merging Word, Excel, Powerpoint And Visio Files Into A Word Document
Does anyone know how to do this or know of a website that has source code that does this? I can't find anything anywhere.

Thx.

I posted this in VB General but then i saw this forum so I wasn't sure where it belonged and posted in both. Reply to either one.

Error 4605 Calling Word.Document.Save With Word 2002 SP1
I have a test VB6 exe project with a WebBrowser control, called web1 (added via Project, Components, Microsoft Internal Controls). My project also references the Microsoft Word 10.0 Object Library.

As well as the WebBrowser control, my form has a Save button (cmdSave). Here is the complete code:


Code:

Private g_objDocument As Word.Document

Private Sub cmdSave_Click()
g_objDocument.Save
End Sub

Private Sub Form_Load()
Dim strFileName As String
strFileName = App.Path & "WordWrapper.doc"
web1.Navigate strFileName
End Sub

Private Sub web1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Set g_objDocument = pDisp.Document
End Sub


The idea is when I run the exe, it loads a Word document into the WebBrowser control. This document is also assigned to
a global Word.Document object, g_objDocument, when web1 navigates to it. The problem occurs when I try to save the document (in cmdSave_Click). I get the error:

"The Save method or property is not available because this document is in another application."

This error occurs with Word 2002 SP 1 (on Windows XP), but not with Word 2000 SP3.

Please help.

Load Word Document In VB Form And Use Word's Zoom Features - Help
Hi

I've this VB6 application where I can opt to load a word document or scaned 8X11 image of a paper form on the VB form and let user write or draw using a tablet. Since screen doesn't have enough space to show complete form at one time, I need to zoom it down to fit the screen so it get mapped properly with tablet. Once user is done drawing or writing, I need to bring the document or image back to original size and print it or save it.

I don't know where to start. Plese guide me about the best way to accomplish this. Thanks.

Convert Html To Word Docuemtn Using The Word Document Object
i ant in vb6 to open an html page
and convert and save it as word *.doc
how can i do this?
and is it possible to open the html file from the internet with a give url so i will be :
open html document from www..../1.html -> save as 1.doc
thnaks in advance
peleg

Load Word Document On VB Form And Use Word's Zoom Fetrures - Help
Hi

I've this VB6 application where I can opt to load a word document or scaned 8X11 image of a paper form on the VB form and let user write or draw using a tablet. Since screen doesn't have enough space to show complete form at one time, I need to zoom it down to fit the screen so it get mapped properly with tablet. Once user is done drawing or writing, I need to bring the document or image back to original size and print it or save it.

I don't know where to start. Plese guide me about the best way to accomplish this. Thanks.

VB In Access To Find And Format A Word In A Mailmerged Word Document
I use my Access data base to create mail merged letters to our customers. Not only are the names etc stored on the database I also store the content of the letter in memo fields. I have occasions where I want the newly created letter to have some words bold. After having VB code open the main document, mail merge then close the main document I run the following code. It works the first time round, the specified word becomes bold. However after closing the letter and running it a second time the new letter opens but no changes are made and I get an error. "Run Time error '462' : The remote server machine does not exist or is unavailable". This gives me a Debug option. When selecting debug The first row in this code is selected.

With ActiveDocument.Content.Find

    .ClearFormatting
    .Font.Bold = False
    .MatchCase = True
    .Text = "SATURDAY"
    With .Replacement
        .ClearFormatting
        .Font.Bold = True
        .Text = "SATURDAY"
    End With
    .Execute Format:=True, Replace:=wdReplaceAll
End With

If I leave the new letter open and re run it the code opens a second new letter with no errors, however it does not make the changes to the newest document only the first new document it finds. ie If I then close the first one created and rerun it the second document will have the changes made and the third one does not change. The error only occurs once I have closed all new documents and try to open another letter.


Hope someone can help

MSAccess Database DOA

Word Automation - Retaining The Numbering Format In New Word Document
Hi all,

I am using word automation to read a word document. I use word automation to read the word document page by page and paste the contents of each page in a new document.

The problem i am facing is, the word document which is read contains Heading1,Heading 2 etc and these are numbered. When I paste these pages onto a new document the numbering is not retained. (Eg., if my Heading1 number is 2.1 when i paste it in a new document the Heading1 number is shown as 1.1)

VBA: Creating Word, And Sending Data To A Word Document Using Ranges
The following code works fine when it is executed only once in any instance of the VB program.

It is OK provided I do not close Word, and it will create multiple instances of the document into the same instance or word.

Screen.MousePointer = 11
GetWord2
WordApp.Documents.Open ("C:Program FilesWill WizardTemplatesClauseLib.doc")
set MyDoc = Documents.Open(FileName:="C:Program FilesWill WizardTemplatesClauseLib.doc")
set FldRng(1) = MyDoc.Range(Start:=MyDoc.Bookmarks("Name").Range.End, End:=MyDoc.Bookmarks("NameEnd").Start - 1) 'read bookmarks into range object variables
FldRng(1).Text = ClauseHold 'put the stuff into the document
WordApp.ActiveDocument.SaveAS FileName:=("C:Program FilesWill WizardTemplates emp" & Trim(Str(TMPNum)) & ".doc")
WordApp.Application.Activate
WordApp.Visible = true
set WordApp = nothing
set MyDoc = nothing
Screen.MousePointer = 0
Command8.Enabled = true
Exit Sub



If Word is closed, and the code is executed again, an error occurs "the remote server machine does not exist or is not available" The only remedy for this is close and re-start the VB application containing this code.

The GetWord2 et-al Function codes are: (which is stored in a module)

option Explicit
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (byval lpClassName as string, byval lpWindowName as string) as Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, byval lParam as Long) as Long
public WordApp as Word.Application
public WordWasNotRunning as Boolean ' Flag for final word unload

public Sub DetectWord()
' Procedure detects a running Word and r
' egisters it.
Const WM_USER = 1024
Dim hwnd as Long
' If Word is running this API call retur
' ns its handle.
hwnd = FindWindow("OpusApp", vbNullString)
If hwnd = 0 then ' 0 means Word Not running.
Exit Sub
else
' Word is running so use the SendMessage
' API function to enter it in the Running
' Object Table.
SendMessage hwnd, WM_USER + 18, 0, 0
End If
End Sub
public Sub GetWord2()

' Test to see if there is a copy of Micr
' osoft Word already running.
on error resume next ' Defer error trapping.
' Getobject function called without the
' first argument returns a
' reference to an instance of the applic
' ation. If the application isn't
' running, an error occurs.
set WordApp = GetObject(, "Word.Application")
If Err.Number &lt;&gt; 0 then
WordWasNotRunning = true
else
WordWasNotRunning = false
End If
Err.Clear ' Clear Err object In Case error occurred.
' Check for Microsoft Word. If Microsoft
' Word is running,
' enter it into the Running Object table
' .
DetectWord
If WordWasNotRunning = true then
'set the object variable to start a new
' instance of Word.
set WordApp = new Word.Application
End If
' Show Microsoft Word through its Applic
' ation property. then
' show the actual window containing the
' file using the Windows
' collection of the MyWord object refere
' nce.
WordApp.Visible = true
WordApp.Application.WindowState = wdWindowStateNormal
Screen.MousePointer = vbDefault
End Sub



do I need to close the document? = deactivate something?

I would like a code example on how to fix the above, else, any suggestions, ideas...


Jason.

A Search Of A Word Document And .XLS Document
Hello,
I need to search a word document for time values that look like this 13:43:42. Find them in a spreadsheet document. Once found there are 3 columns of data in the .xls that correspond to the time. This then needs to go into a .txt file. Then need to search the word document again for the next time and do again. When done the final .txt file should have the time and cooresponding data across the page. Who out there can put this together to run in a macro?

Word Document (*.DOC) And WordPad Document (*.DOC) ?
Hi,

I need to identify that a document file (*.DOC) is a Word document or a WordPad document in me program. Because WordPad can not open always a file (*.DOC) which can be openned by WORD.

Thanks

nYU

Word: Counting A Specific String In A Word Document
Hi all,

After visiting the Word FAQ I couldn't find any clue for my query:
I would like to count (in VB) how many times the string "Yesterday"
appears in a word document I am working on.

By using the manual Replace function (replacing "Yesterday" by "Yesterday"),
Word tells you how many replacement it has done and therefore how many
instances of the string "Yesterday" were in the document.

Can anyone point me in the right direction about using VB to find out
how many times "Yesterday" appears in my document, please?

Many thanks
Francois

Can I Insert A Word In The Cursor Position In A Word Document
I use this statement in VBA2000:

ActiveDocument.Content.InsertAfter ("USA")

but it alwasy insert at the end.

How can I insert a word in the cursor position?

Selecting A Particular Word From A Word Document (.doc) Through Visual Basic 6
I am a developer using Visual Basic 6. One of my program accepts some values through text boxes and then creates a Word document. The text boxes are optional, and the created Word document contains only non-empty values along with appropriate labels. I am able to apply styles (bold and underline) to entire paragraphs. But the user wants me to apply bold formatting only to values entered by him and not to the labels which describe those values. Please help me.

Thank You.

Lalit Kumar Barik
India

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

Word Form &gt;&gt; Process &gt;&gt; Word Document
Please be gentle, as this is my first foray into VBA. To make matters worse, I'm not a programmer, just someone who needs to get something done. My guess, based on what I want to do, it that I can do it easiest in VBA, but I am hoping this forum will help flesh out that answer for me.

In a nutshell, I am trying to create a document (possibly a Word form?...) that has a definite format with fields to be filled in (mostly numberic values, checkboxes, or free text). This form will be filled out by our techs at a customer site. They may do this 'live' with Word open, or they may print it out, then fill in the document later from their handwritten copy.

Next, I would like to 'process' their answers by feeding some information directly into an output document (Word hopefully). Now, some fields like name, address, etc... will go straight over and don't require manipulation. Some other data will need to be processed.

For example, if the tech fills in 34, I might want the output document to put 'this text' under a certain heading. If it is >34, then some other text, less, maybe no text. I'd also like to be able to change some graphics based on limits. i.e. if the value is less than this, insert this picture into the output document at a specific location, if not, insert this picture.

So, in general, before I go down the road of learning a language... do the members here think VBA would be a good choice for this? Would I 'read' from the input document in Word Excel, process in Excel and then pump data out to the output docment, etc... I am looking for advice whether this is;

1. fairly straightforward, understanding that I would need to learn some VBA.
2. possible
3. a good choice. i.e. would another language, or a pre-done software make a better choice.

My contraints are that my company has Office 2000 rolled out, WITHOUT Access. We use Lotus Notes and Access is apparently frowned upon. I am an optimist, so I expect it's possible with careful design and help from the experts who've been down these roads before.

Thanks in advance for any help, insight, advice or code.

Regards,
John

Opening A Word Document With Word From Excel
i want to have a part of an excel macro where it opens up a word document in word (so it would have to open the application itself) and then be able to do everything that i can do using the word vb editor. is there some easy way to do this?

Opening An Application Such As Word Document Using Word
how to open a .doc file using a word exe through vb gui.

regards
raghav

Change Word On The Footer Of A Word Document
I like to change the word "Version 1.0" to "Version 2.0" on every page on the footer of a word documents using VB6 with the word document minimised when the program is making the change. Does anyone know how to do this? Thanks.

Word -VBA / Accessing Content Of A Word Document
Group:

Can you access the conent (document.WholeStory or document.Conent) of a Word document without opening the document or triggering the OpenDocument event?

Mark

Deleting Word Document Using Vb For Word 2000
hi

how to delete a word document from the hard disk using vb for word 2000?
i tried using kill function but it shows an error -"permission denied"..pls can sum1 help?

Find A Specific Word From Word Document...
Hi All,

Need help...

i have a word doc. it contains some data.. and bottom of the page it contain the following paragraphs. its single page word doc.
Code:Very truly yours,
sam
Officer

From vb i want to find word, the next line of the 'very truely yours'. like here in this example i have to capture the value 'sam'.

Any idea how to get that..


Thanks
Balakumar

Edited by - pmmbala1976 on 6/2/2004 4:45:19 PM

Deleting Word Document Using Vb For Word 2000
hi

how to delete a word document from the hard disk using vb for word 2000?
i tried using kill function but it shows an error -"permission denied"..pls can sum1 help?

Printing A Word Document Using Word.Application
Is there a way to fire a print out to a particular printer using word.application object

Thanks in advance for any help.

N G

Tricky Search Of A Word In A Word Document...
I need to create a VB project that searches a word in a
Microsoft Word document, counts the number of apearences
and the page and row where the word apeared.

Ex.
Suppose I need to search the word: "please"
The result should be of this form:
please - 1/2,3 ; 4/1,13

This means that the word "please" was found in the document on the line 2 and 3 of the page 1, and on the line 1 and 13 on the
page 4.

Please tell me if this can be done. I need it ASAP.

Thanks.

How Can I Open A Word Document In Word Pad Using VB/VBA?
Hi all,

I need to open my Word document in Wordpad (which comes with Windows operating system for some specific purposes) and save it as Word 6.0 document / Rtf format. So, How can i do that?

Pls help me.

Thanks,

CS.

Do You Have To Have MS Word To Run A MS Word Report/document
I have a small vb app that I am trying to run on a server. This app creates a word document and prints it out like a report, but I don't want to require the server to have MS Word installed. I have tried to include the MSWORD.OLB file that I have referenced in my project. When i run the program it is giving me an activeX object error. Is this even possible to just use a MS Word control without having MS Word installed?

Count Of Document In VB6 Mismatch With Word Count When Opend In Microsoft Word
Can anyone kindly help me.

I have written program in VB6 to take counts of Word document - Characters, lines, paragraphs, words. They are not matching when document opend in Microsoft word and seen word count (in tools menu). Also can any one guide me in knowing the command to get page count of word document in VB6. Thanks a lot in advance.

 

Edited by - sarikondak on 6/9/2005 8:34:36 PM

How To Populate A Word Document In Server By Creating A Word Instance On Server.
Hi,

How to populate a word document in server by creating a word instance on server. I am developing a client server application, we don't have MS-Word in the client machine, but i want to create a word document on server by sending the content to a function.

Please let me know the possibilities.

Thanks
Jeyakumar

Why Is There No Word Document
Hello, could someone tell me why in the components when I choose the Microsoft Office Web Components, I get an Excel Spreadsheet but no Word document. I know that in a previous project I was able to find the MS Word component. Am I missing something?

I appreciate any help,

Dan

Word Document Still Not On Top
I am opening a document in Word from my VB app and want it to appear on top of my app - in other words, active and in the foreground, maximised.

objDoc.Activate
objWord.Visible = True
objWord.Windowstate = vbMaximised

It still appears in the toolbar at the bottom of the screen, minimised - any ideas?

Word Document Not On Top
I use the following code in several places in my app to open a Word document. Sometimes the document is opened on top of my app (this is what I want to happen) but sometimes it just appears in the tool bar. Any idea why?

objDoc.Activate
objWord.Visible = True

Word Document To VB
A shared objective asks that our current manual A4 daily process tick list, produced by Word, be automated to allow easy additions and deletions of processes, plus be able to flag problems to our technical support when they occur, and allow a daily printout. To be run from the office PC.
I have to design the plan and my colleague is required to do any programming but I would like to know if VB would be practical for this type of project? Any pointers at our starting point would be most welcome.

Set Name For Word Document In Vb
Hi all.

I open a new word document with vb like this


Code:
Set wordApp = New Word.Application

With WordApp.Application
Set wordDoc = .Documents.Add ( , False, 0, True)

.Visible = True
End With

Now I want a user to enter a name for the document in a textbox in vb and that open the new document like in the code above. How can I give the new document the name that the user entered? (when the user opens the save-dialog in word the name in the vb textbox should appear as the filename)

Using Word Document
Can anyone tell me,

Is it possible to have a generic word document with a few blank spaces for adding text?

such as

My name is ________________
I am interested in knowing more about__________
etc.

The blanks would obviously be filled with input from a textbox.

Word Document
I want to write a program that the user either inputs information into text boxes or selects items in a combo box and then the results of this are sent to a Microsoft word document. What I need to know is, how do I send the info to a specific position on the document? I was thinking that I could store the info in a database and use the merge attributes of the word document. If I were to do that, I would like for the merge operation to happen automagically with the information the user has input. Is this possible?? I hope so!!
Thanks in advance!
Rick

Go To End Of Word Document
Hi,
I have to create an application which takes screen shots and pastes it into a word document. Managed to do this, but I have a problem. When, I insert using the below code. The images get added at the start of the document instead of at the end. Can anyone help on this.


Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const VK_SNAPSHOT As Byte = 44
Private m_wrdApp As New Word.Application
Private m_wrdDoc As Word.Document

Sub Main()
Clipboard.Clear
DoEvents
Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
DoEvents

strFilePathName = "C:Doc1.doc"
Set m_wrdDoc = m_wrdApp.Documents.Open(strFilePathName)
m_wrdDoc.Content.InsertBreak (wdPageBreak)
m_wrdDoc.Content.InsertBreak (wdLineBreak)
m_wrdDoc.Content.Paste
m_wrdDoc.Close
m_wrdApp.Quit
End Sub

MS Word Document And VB
Hi,

I'm a newbie and would just like to ask a question. I am creating a small documentation tool which reads data from a database. I have already done the program and it is creating an HTML File.

Now, i would like to do the same thing but the document would be in microsoft word format, is it possible for me to do this?

Do you have any sample programs of manipulating a microsoft word document(creating tables etc...)

Thanks in advance...

Word Document In VB
Want to include a word document on a VB form how can I just include the document on the word application itself.

Thanks

Word Document In Vb 6.0
How to call a word document in vb 6.0 form ?
help me

Ole And Word Document
I am using ole to embed a word document. It is working fine, But
the problem is the document gets refreshed after each interval of time.
Hence its focus goes to the starting position of the document.
And I lost the current position of cursor in the document
I know the UpdateOptions property of the ole control and I tried to set
it to frozen and manual also but there is no change in the behavior.
Please let me know how can I stop it.

Word Document
When you open new document in Word and start typing, Word will save it now and then.

Where does Word save the document before you save it. What's the directory where all the autosaved documents go?

Get Word Document
I wish to get the word document object and manipulate the code module of that document. how to do this in vb??

Word Document From My App
I have created a Word document in my app and opened it so the user can edit/save or whatever. In my form unload I want to quit word and set my objWord to nothing but only if the user hasn't. How can I test this??

New Word Document
The only way I know of checking for word is to use the api and enumerate windows, where the class is equal to word's window class. Then using it's handle create a child window which should create a new document. I only ever did this once about 2 years ago and it was a complete nightmare. If I find my code I'll forward it on, but the window class's are buried deep in MSDN.

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