Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Word.Application

Status
Not open for further replies.

robydrupo

Programmer
Jun 23, 2006
2
IT
Hi, I have a problem with Word.Application I copy and paste from several Word document

oWord.Documents.Item(1).Range.Copy;
OWordOut.Documents.Item(1).Range(OWordOut.Documents.Item(1).Range.End - 1, OWordOut.Documents.Item(1).Range.End - 1).Paste;

where OWordOut

oWordOut := CreateOLEObject('Word.Application');

The copy and paste works fine, but when i print the oWordOut

oWordOut.DisplayAlerts := False;
MyDialogs := oWordOut.Dialogs;
if MyDialogs.Item(88).Show = -1 then
begin
oWordOut.ActiveDocument.PrintOut(False);
end;

I receive a message like this "Save the Normal.dot file?". Only in a Windows 2000 + Office 2000 machine. In another machine (win xp + office 2000) I receive nothing. Any suggestion?? Thanks! (and sorry for my bad english!)
 
First we have to prepare the word layout

Open Word, go to Tools --> Macro --> Record new macro

We will:

1) Set the page layout out to portrait to create space for the table
2) Prepare the header by typing in the 10 column names separated by ;
after the last name type in enter
3) Fill in two rows of data separated by ; (remember to type in enter at the end of the row)
4) Chose Select All from the Edit menu
5) go to Table --> Convert --> Text to Table
6) Indicate ; as the separator and use AutoFormat --> Table Contemporary
7) Apply formating using tab and Table --> select Column to align the numbers to the right
8) Center the column titles with Table --> select Row
9) Stop recording

After that the macro editor is used to visualize the VB commands.

This is part of How to export data from a query to Word
faq102-6016

I would use the macro recorder in word to expose the correct sintaxe to print.

Regards




Steven
 
The problem isn't the print of the document....the print works fine, but in some machine appears a message "Save the Normal.dot file?" before the print dialog appears.
I would that nothing appears when I print a word document(in my machine I don't receive anything windows xp + office 2000)...

Any suggestion??

Thanks, roberto
 
The thing works, thus no problem, blame it on a Micro$oft bug, they are big fat target anyway [thumbsup]

Steven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top