A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Word Crashes intermittently



 
 
Thread Tools Display Modes
  #1  
Old June 10th, 2004, 10:31 AM
Ravi Chand
external usenet poster
 
Posts: n/a
Default Word Crashes intermittently

Hi

My code adds a new document at run time and then pastes
some stuff on
it. After manipulating this data it fetches it and inserts
it in a
different word document. The problem is, intermittently
word is
crashing with this code. It doesn't happen everytime and
on every
machine.

The code looks something like this...

'Create a new document object
Dim objWdDoc As Document
Set objWdDoc = objWord.Documents.Add(, , , False)

'Paste the content of the clipboard in the new document
objWdDoc.Content.Paste

'Format the tables
For tableCount = 1 To objWdDoc.Tables.Count
objWdDoc.Tables(tableCount).Rows.LeftIndent = 0
objWdDoc.Tables(tableCount).Rows.Alignment =
wdAlignRowLeft
objWdDoc.Tables(tableCount).Range.Font.Name
= "Reuters Mono"
objWdDoc.Tables(tableCount).Range.Font.Size = 10
objWdDoc.Tables(tableCount).Range.Font.Color =
wdColorBlack
objWdDoc.Tables(tableCount).Range.Font.Bold = 0
objWdDoc.Tables(tableCount).Range.Font.Underline =
wdUnderlineNone
objWdDoc.Tables(tableCount).Range.Font.Italic = 0
Next

'Extract the formatted data
Dim wrdXML As String
wrdXML = objWdDoc.Content.Xml
objWdDoc.Close (False)
Set objWdDoc = Nothing

'Insert the data in the original document...
objWord.ScreenUpdating = False
objWord.Selection.InsertXML wrdXML
objWord.ScreenUpdating = True


The problem is, intermittently word is crashing with this
code. It
doesn't happen everytime and on every machine.

Any help would be appreciated.

Thanks and Regards
Ravi Chand.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.