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




Word Document To Outlook Message Loses Formatting


Hi I'm using the following code (extract) to open a word document, replace certain text, then if an Email boolean is flagged, create an email and put the contents of the word document in that email.


Code:
' create document
'open file
Set objWordApp = CreateObject("Word.Application")
Set objWordDoc = objWordApp.Documents.Open(App.Path & "/action_docs/" & strFile, ReadOnly:=True)
Set objWordRange = objWordDoc.Content
objWordApp.Visible = False

For i = 0 To UBound(arrFind)
'find and replace fields
With objWordRange.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = arrFind(i)
.Replacement.Text = arrReplace(i)
.Execute Replace:=wdReplaceAll
End With
objWordDoc.Select

Next i

'check if email, if so populate fields
If blnIsEmail = True Then
' create new mail message

Set objOutlookApp = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlookApp.CreateItem(olMailItem)

objOutlookMsg.subject = ""
objOutlookMsg.Body = objWordRange
objOutlookMsg.To = arrAddressTo(j)

objOutlookMsg.Display
objWordDoc.Close wdDoNotSaveChanges
objWordApp.Quit
Set objWordApp = Nothing
Set objWordDoc = Nothing
Set objWordRange = Nothing
Else
objWordApp.Visible = True
End If
This all works fine however the formatting of the original word doc is lost when put into outlook. Can I preserve the formatting?

Any help is greatly appreciated.

Cheers, Dan




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Formatting Word Document Help
Hi Guys,

Good day!!!!

I have a formatting problem with MSword in Visual basic. I have a word document in a folder say 'X'. I am currently taking this word document from x folder, applying some formatting like changing the font. I have to do two more options.

1. Save as landscape document
2. Set margin @17 all sides.

Any lights on this issue?.....

Thanks,
Srini

Formatting Word Document Through VB
Set worddoc = New Word.Application
worddoc.Documents.Add
Set objdoc = worddoc.ActiveDocument
Set Range = objdoc.Range(Start:=0, End:=0)

    Range.InsertBefore "CHANGE CONTROL PROCESS REQUEST FORM" + vbCrLf
    Range.Font.bold = True
    Range.Font.Size = 14
    'Move to next paragraph
    Range.MoveStart Unit:=wdParagraph
    Range.InsertAfter "" & vbCrLf
    Range.InsertAfter "Client: " & rsTemp2!Name & "" & vbCrLf
    Range.MoveStart Unit:=wdParagraph
'I need to bold and underline "Prepared by" and then insert the rest of the line but I am unable to figure out how.
    Range.InsertAfter "Prepared by: " & rsTemp2!primarycae & "" & vbCrLf

Formatting Word Document
I'm creating a report in Word which will contain data I get from Excel. Right now, I have a blank Word document opening up, and then I had planned on simply coding in VBA what I'd like to go into the document. So, my questions are:

1.) Would it be better to create some sort of Word template rather than doing everything from a blank document. If so, how do I open that instead of the blank new document?

2.) How do I format the entries into the Word document from VBA. I'd like to do things such as center lines, change fonts, etc.

Thanks so much!

Formatting A MS Word Document
Hi Developers,

How can I change format (like changing Left Margin or character spacing etc.) of a MS Word file stored in disk programmatically?

Thanks

Word Formatting And Document Variables
I am working on some automated word documents with VBA. Basically, when the document is opened, a userform appears asking for relevant information. That information is then placed into the word document in various locations (some information in multiple places) over a large number of pages by the form. Then the user can click print, and have this form largely filled out - without having to print a blank one and type in it - and without having to tab through a bunch of fields in the document and type a lot of the same information over and over again a dozen times. The problem, or fear, that I have is maintaining the pages formatting. For example - if someone types in way too much information - it will force the document to continue onto another page - which isn't good for the purposes of this program. Other situations are when the form puts the name in the word document, but it's so long that it carriage returns the place i've made available for date to the next line. Which kills the uniform look of the page, and makes the lsat little bit of legal info print on a whole other page. Is there a way around all of this mesS?

How To Remove Text Formatting From Word Document?
Where are mistakes in my VB code? Help me, please!

This macro must search in a word document string "Harijs" and remove any formatting (no important if "Harijs" was formatted or not), but it works wrong

Code:
Sub UndoFormat()
  Dim oRange As Range
  Set oRange = ActiveDocument.Range
  Application.ScreenUpdating = False
  With oRange.Find
    .Text = "Harijs"
' Here i didn't wrote .Format = True, but results were wrong too
    .Format = True
    Flag = .Execute
    While Flag = True
' Here i wrote .Format=False, but it didn't work again Then i wrote only bold and italic format with ".Parent" and without ".Parent" and there were mistakes again.
      .Parent.Font.Bold = False
      .Parent.Font.Italic = False
      oRange.SetRange Start:=.Parent.End, End:=ActiveDocument.Range.End
      Flag = .Execute
    Wend
  End With
  Application.ScreenUpdating = True

VB Automation For Formatting Text Of Exisitng Word Document
Hi,
Here is my problem description:

I have a chunk of text in a word document. Every word here is marked with a custom bookmark and the entire text chunk is marked by a start / end bookmark.The text is formatted in a certain way, say for eg: every sentence begins at a newline.
Based on a hotkey, or an event, I want to go into the word document, read this chunk and manipulate the formatting.

Would anyone know how this could be done? is it even possible?? This is urgent and any help would be appreciated. U could email me directly at jagdsingh@yahoo.com
thanks a lot.

Saving Formatting Of RichTextBox When Converting To Word Document Using VB
I am using RichTextBox in VB application and i want to save this text of RichTextBox with ALL the formatting into a MS word document using VB. I have also taken the textRTF of the RichTextBox control but in the word document it appears as rtf text(Garbage). Pl. help me out...!!! its urgent. kindly tell me how to save the format of the RichTextBox when converting it into word document. Thanks

Downloading A .txt Loses It's Formatting
Hi all,

I have a .txt file stored on a server, not it's pretty well formatted with paragraphs, spacing, tabs, and even bullet points. When accessed directly with the browser, it displays fine. However, using Inet's GET method:


Code:
TextIn = WebInet.OpenURL("http://URLHERE/DIR/Assign.txt")
Open "C:Assign.txt" For Output As #FF
Write #FF, TextIn
Close #FF


DFU
Shell "notepad.exe C:Assign.txt", vbNormalFocus


Or the "DownloadFromURL" method:


Code:
Private Sub DownLoadFromURL(ByVal url As String, ByVal filename As String)
'
' Download a file from a given URL
'
Dim bytes() As Byte
Dim fnum As Integer
Dim ftext As String
'
' Download the file and load into byte array
'
ftext = url & filename
bytes() = WebInet.OpenURL(ftext, icByteArray)

fnum = FreeFile
'
' Write the downloaded file to disk
'
Open "C:" & filename For Binary Access Write As #fnum

Put #fnum, , bytes()
Close #fnum

End Sub



DownLoadFromURL "http://URL/DIR", "Assign.txt"


Just download the text file as one huge block of text, unformatted, with wierd characters where the bullets / tabs should be. How can I download the file and retain it's original formatting? I can use this GET method to download a .doc of the same file, and it stays completely in tact

Thanks

Turn Off Word's 'This Document Caused An Error The...' Message
Hi all,

Does anyone know a way to turn off Word's 'This document caused an error the last time it was opened' message?

I sometimes get this message when my application automates Word, but the dialog box is always hidden behind the application and so is not seen. It thus appears to the user as if my application has crashed!

Thanks.

Access Report To Rtf File - Loses Graphics And Formatting
My program creates opens a report using DoCmd.SendReport

It sends the report in RTF format as an attachment in an email.

The reports looks OK but it loses a lot of the formatting ... i.e. any highlighting of text in addition to losing the graphics or company logo.

I've used both the image control and the Unbound object control to insert a company logo but when you open the email attachment which is an rtf file of the report, the logo graphic does not appear.

Is there any way to get around this and still keep graphics in a report after it has been exported to a different format?

Thanx,

Lorin

Sending Word Document Through Outlook With Vb6
I have a word document with some graphics, formatted text and a table.
I have tried the following:

OutlMailItem.Body = wdoc.Content

but when i look in the message body i see only plain text.
Is there any way to send a word document in the message body and not as an attachment?

I use Office 2002 sp3 and vb6 sp6.

(P.S.)

DataSet Loses Info After MdiChild Loses Focus.
I think this is roughly the right forum to post this to...if not, please let me know.

My question involves MdiParent and MdiChild with OleDB. I've got a MdiChild that has a datagrid that I fill using a DataAdapter and a DataSet. The grid and all works great. I'm now trying to implement a delete record task that I initiate from a menu. The menu happens to be attached to the MdiParent. It seems that when I access the menu and call a Delete procedure from the MdiParent (Delete procedure is in the MdiChild.vb), the procedure loses all the info on the grid's datasource, namely the DataSet. I can't get back to the DataTable, I can't reset the DataSet, etc. I can get the clicked row in the grid, but the grid acts like no datasource is there (The DataSet is Null). Best I can assume is that the when the MdiChild loses the focus (by clicking the menu item from the parent) after filling the dataset, everything goes Null. I guess I can buy that, but it just seems odd to me. Does anybody have any ideas on how to proceed? I have quite a few things I want to do in this manner (deletes, edits, etc.) I'd rather not have to deal with merged menus, but if I have to, I guess I'll have to.

Thanks for any help you can provide.

How To Turn Off "Use MS Word To Edit Email Message" In MS Outlook VB
Hi everyone,

I'm looking for a way to uncheck "Use MS Word to edit email message" in MS Outlook programatically. Does anyone know the code in VB?? Thanks.

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?

Message Box Formatting
Does antone know how to format a message box's text that it displays? Specifically Color and Center. Any help would be greatly appreciated...

Message Formatting Woes...
Hello everyone,
As most of you probably know(due to the fact that I've posted other questions about it) I'm building a chat program in Visual Basic 6. I've been having lots of fun building and learning and all has been pretty smooth until now. I've hit a point that I don't think I can get past without help.

Here is my situation. I have three elements on my form which are important for this question. They are two rich text boxes and one command button. One rich text box is called txtHistory and it's a big box for displaying the messages from all the users in the chat. The other rich text box is called txtMessage and it's for the user to type the message he/she wants to send. The command button is called cmdFormat and it's for formatting text. The user selects some text in txtMessage and hits the cmdFormat button and the Windows font dialog comes up. They can change the settings and hit "OK" and those settings will be applied to the selected text in txtMessage. All that works fine. Now to the problem.

Once you have added the formatting through the font dialog and hit "Send" the message goes to the server and then shows up in the txtHistory box. That also works fine. The problem is, once you send the message and it comes back to the txtHistory box all the formatting doesn't show up. It's just plain text.

I have tried several things to fix this but nothing has worked. I have searched clear though this forum and Google and many other forums but have not found a straight answer.

Rather than attempting to explain every little detail about my project and hope someone understands what is wrong, I'm going to post my project file so you guys can look at it and try to figure out what is wrong.

I'll really appreciate any help any of you can provide and thank you in advance to those who can help.

New To SOAP.. Need Help Formatting My Request Message
i'm creating a program that will access the ignyte systems webserver in order to obtain movie theatres and times. I have a piece of code put together that currently doesnt error out (surprising because i'm new to vb6 as well), but does not return the requested information. Quite frankily i call the function and it appears to do nothing. Now i have an example request xml that i'm going off of thats successfully works with the webserver. The example is below


Code:
POST /webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx HTTP/1.1
Host: www.ignyte.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.ignyte.com/whatsshowing/GetTheatersAndMovies"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetTheatersAndMovies xmlns="http://www.ignyte.com/whatsshowing">
<zipCode>string</zipCode>
<radius>int</radius>
</GetTheatersAndMovies>
</soap:Body>
</soap:Envelope>


here is my function


Code:
Public sClient As New MSSOAPLib.SoapClient
Private Const c_WSDL_URL As String = _
"http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?wsdl"
Public OSKCode As String
Public MovieZip As String

Public SDK As Object
Public MovieStatus As String
Public MovieDownloadTime As String
Public MovieDownloadDate As String
Dim strsvc As String


Private Sub Command1_Click()
Dim objClient As MSSOAPLib.SoapClient
' To package SOAP request.
Dim objSerial As MSSOAPLib.SoapSerializer
' To read SOAP response.
Dim objRead As MSSOAPLib.SoapReader
' To connect to Web service using SOAP.
Dim objConn As MSSOAPLib.SoapConnector
' To parse the SOAP response.
Dim objResults As MSXML2.IXMLDOMNodeList
Dim objNode As MSXML2.IXMLDOMNode

' Set up the SOAP connector.
Set objConn = New MSSOAPLib.HttpConnector

objConn.Property("EndPointURL") = "http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx"

'GetTheatresAndMovies is the name of the service
objConn.Property("SoapAction") = "http://www.ignyte.com/whatsshowing/GetTheatersAndMovies"
'objConn.Property("SoapAction") = "GetTheatresAndMovies"

' Begin the SOAP message.
objConn.BeginMessage

Set objSerial = New MSSOAPLib.SoapSerializer
' Initialize the serializer to the connector's input stream.
objSerial.Init objConn.InputStream

' Build the SOAP message.
With objSerial
.startEnvelope ' <SOAP-ENV:Envelope>
.startBody ' <SOAP-ENV:Body>
' Use the Web method's name and schema target namespace URI.
.startElement "GetTheatersAndMovies"
.endElement
.endBody ' </SOAP-ENV:Body>
.endEnvelope ' </SOAP-ENV:Envelope>
End With


' Send the SOAP message.
objConn.EndMessage

Set objRead = New MSSOAPLib.SoapReader

' Initialize the SOAP reader to the connector's output stream.
objRead.Load objConn.OutputStream

Set objResults = objRead.RPCResult.childNodes

' Iterate through the returned nodes.
For Each objNode In objResults
'Debug.Print objNode.nodeValue
MsgBox objNode.nodeTypedValue
Next objNode


End Sub


running this function does not present any msgbox and it appears as no data is returned. I believe this has to do with the fact that my function does not send the <zipcode> and <radius> as a part of the request. How would i had those to my function? Any guidance would be greatly appreciated.

Formatting Text For An Error Message
Somebody recently posted a reply to one of my questions with a routine that automatically formatted text being used in a message box.

Can't find it not though, so wondered if anybody else had a piece of code they used for this purpose.

Do I win 'Laziest Person of the Day Award' ?

MAPI : Message Formatting Not Working
Hi

I have developed Email application using CDO objects and outlook'97 as mapi client. After I compose a message, with some formatting like making few words bold and increasing the font etc. The same message when received is not retaining the formatting what I had done to the message. how can I retain the formatting of that message. I am using a Rich text box control for typing the body of the message. Can any one tell me where the problem lies.

Regards

RM

Formatting Email Message With HTML ??
I have a VB program that creates email messages and sends them via MAPI control with Outlook Express.

My program looks at customer's orders and builds the email message to a string variable then sends the string to outlook express to be sent.

However let's say I have columns of data to send in my message. How can I format the columns so they will be in a HTML grid ?

Listed below is an example of what a typical email message looks like now in standard text. Can anyone help me understand how to format this in HTML with the orders in an HTML grid ? I have no experience in HTML so any examples you can provide would be most helpful indeed. Thanks.

Your recent orders

------------------------------------------------------------------------
| Order # | Ship On | Cancel On |
------------------------------------------------------------------------
17272 10/12/2004 11/01/2004
18387 10/14/2004 11/02/2004

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

MS Word, Excel, Outlook[or Outlook Express] Detection
How can I detect if MS Word, Excel, Outlook Express, Outlook are instelled into the computer, using VB?
(Obviously through registry, but how? - I know nothing about information from registry records => a website link with information about registry would also be very welcome)

Formatting Outlook Mail Using Rich Text Box
Hi,
I am using a rich text box in my VB form and I want that all the formatted text entered into the rich text box be displayed in the body of the outlook mail.
If I pass richtextbox1.text to the outlook mail item it removes all the formatting done in the rich text box.
If I pass richtextbox1.rtftext to the outlook mail it displays the formatting characters also in the box for eg it displays {rtf ansi etc...

I tried to set the body format of the outlook mail item object to olFormatRichText but it also did not help.

Please help me

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?

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