473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Word Automation

My boss is more and more asking me to get into areas of report formatting
and such with the primarily database apps that I write.

I am not pleased with Crystal and some of the pitfalls I have seen with this
particualar report tool.

I would like to delve into Word automation ( I believe you can control page
breaks and such with this). Can someone point me to a good how to with the
various methods available there?
Nov 20 '05 #1
8 2414
Check the "Microsoft Word Visual Basic" reference in the Microsoft Word
Help, under "Programming Information" in the contents.

"scorpion53061" <sc************@yahoo.com> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
My boss is more and more asking me to get into areas of report formatting
and such with the primarily database apps that I write.

I am not pleased with Crystal and some of the pitfalls I have seen with this particualar report tool.

I would like to delve into Word automation ( I believe you can control page breaks and such with this). Can someone point me to a good how to with the
various methods available there?

Nov 20 '05 #2
I don't like the implementation of Crystal in VS.NET only b/c of the lack of
a preview feature...but as far as Page Breaks and the rest...you can
definitely do it with Crystal. Mastering Visual Basic.NET by Sybex has a
pretty good section on Word automation, but be forewarned, it can be quite
slow compared to running standard word macros. We had a few in both Excel
and word that exectued in a few seconds in either the Word or Excel
environment, ported the exact code to .NET and it ran much slower, sometimes
as long as a few minutes to do what executed in a few seconds.

Component One has a product called Active Reports that's free right now and
I've used to it with a good deal of satisfaction. However, I wouldn't write
off Crystal Reports just yet...it's probably the best report writer on the
market.

HTH,

Bill
"scorpion53061" <sc************@yahoo.com> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
My boss is more and more asking me to get into areas of report formatting
and such with the primarily database apps that I write.

I am not pleased with Crystal and some of the pitfalls I have seen with this particualar report tool.

I would like to delve into Word automation ( I believe you can control page breaks and such with this). Can someone point me to a good how to with the
various methods available there?

Nov 20 '05 #3
Hi scorpion53061, till MS rewrites OFFICE in dotnet and provides a dotnet
interface for automating, it is best to stick to VBA or compiled VB6 code
( I would prefer the latter). We do serious office integration and believe
me VB6 is the best option.
Nov 20 '05 #4
Thank you for the input........
I find it quite strange that MS does not make their own products friendly in
their development environment.

"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:uR******************@tk2msftngp13.phx.gbl...
Hi scorpion53061, till MS rewrites OFFICE in dotnet and provides a dotnet
interface for automating, it is best to stick to VBA or compiled VB6 code
( I would prefer the latter). We do serious office integration and believe
me VB6 is the best option.

Nov 20 '05 #5
I will look for this active reports software.

I didn't fault Crystal for its ability in writing. However I have noticed
that when I used it with apps just here in this office I noticed windows
stability issues (especially 2000) that were difficult to understand
(crashing, certain dll files caused problems)

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl...
I don't like the implementation of Crystal in VS.NET only b/c of the lack of a preview feature...but as far as Page Breaks and the rest...you can
definitely do it with Crystal. Mastering Visual Basic.NET by Sybex has a
pretty good section on Word automation, but be forewarned, it can be quite
slow compared to running standard word macros. We had a few in both Excel
and word that exectued in a few seconds in either the Word or Excel
environment, ported the exact code to .NET and it ran much slower, sometimes as long as a few minutes to do what executed in a few seconds.

Component One has a product called Active Reports that's free right now and I've used to it with a good deal of satisfaction. However, I wouldn't write off Crystal Reports just yet...it's probably the best report writer on the
market.

HTH,

Bill
"scorpion53061" <sc************@yahoo.com> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
My boss is more and more asking me to get into areas of report formatting and such with the primarily database apps that I write.

I am not pleased with Crystal and some of the pitfalls I have seen with

this
particualar report tool.

I would like to delve into Word automation ( I believe you can control

page
breaks and such with this). Can someone point me to a good how to with the various methods available there?


Nov 20 '05 #6
Where did you see the free Active Report download at?

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl...
I don't like the implementation of Crystal in VS.NET only b/c of the lack of a preview feature...but as far as Page Breaks and the rest...you can
definitely do it with Crystal. Mastering Visual Basic.NET by Sybex has a
pretty good section on Word automation, but be forewarned, it can be quite
slow compared to running standard word macros. We had a few in both Excel
and word that exectued in a few seconds in either the Word or Excel
environment, ported the exact code to .NET and it ran much slower, sometimes as long as a few minutes to do what executed in a few seconds.

Component One has a product called Active Reports that's free right now and I've used to it with a good deal of satisfaction. However, I wouldn't write off Crystal Reports just yet...it's probably the best report writer on the
market.

HTH,

Bill
"scorpion53061" <sc************@yahoo.com> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
My boss is more and more asking me to get into areas of report formatting and such with the primarily database apps that I write.

I am not pleased with Crystal and some of the pitfalls I have seen with

this
particualar report tool.

I would like to delve into Word automation ( I believe you can control

page
breaks and such with this). Can someone point me to a good how to with the various methods available there?


Nov 20 '05 #7
well one day for about an hour and a half it was pretty slow so I decided to
give this a shot.
It is pathetic admittedly. But hey got to start somewhere.

If anyone can advise me of how to actually get this data into word please
let me know....

Private Sub FillIN()
Dim wordApp As Word.Application
wordApp = CreateObject("Word.Application")
Dim wordDoc As Word.Document
Dim wordRng As Word.Range
Dim wordPara As Word.Paragraph
Dim wordRng1 As Word.Range
Dim wordPara2 As Word.Paragraph
With WordApp
.WindowState = Word.WdWindowState.wdWindowStateMaximize
.Documents.Add()
wordApp.Visible = True
wordDoc = wordApp.ActiveDocument
wordRng = wordDoc.Range
wordRng1 = wordDoc.Range
With wordRng
.Font.Bold = True
.Font.Italic = True
.Font.Size = 14

.InsertAfter("Invoice - Customer 252991")
.InsertParagraphAfter()
End With
wordPara = wordRng.Paragraphs.Item(3)
With wordPara.Range
.Bold = False
.Italic = True
.Font.Size = 14
End With
With wordRng1
.Font.Bold = True
.Font.Italic = False
.Font.Size = 13
paragraphcount = 0
Dim i, r, c As Integer
For i = 0 To Stock11.Tables.Count - 1
'.Tables.Add(wordRng1, 1, c)
For c = 0 To Stock11.Tables(i).Columns.Count - 1
.InsertAfter(Stock11.Tables(i).Columns(c).ColumnNa me
& vbTab)
Next
For r = 0 To Stock11.Tables(i).Rows.Count - 1
'.InsertParagraphAfter()
'.Rows.Add(r)
For c = 0 To Stock11.Tables(i).Columns.Count - 1
.InsertAfter(Stock11.Tables(i).Rows(r).Item(c) &
vbTab)
'.InsertParagraphAfter()
Next
.InsertParagraphAfter()
paragraphcount = paragraphcount + 1
Next
Next

paragraphcount = paragraphcount + 1
.InsertAfter("Customer 252991")
.InsertParagraphAfter()
' Insert a blank paragraph between the two paragraphs.
.InsertParagraphAfter()
paragraphcount = paragraphcount + 2
wordPara2 = wordRng1.Paragraphs.Item(paragraphcount)

With wordPara2.Range

.Bold = True
.Italic = False
.Font.Size = 13
End With
End With
End With
'.ActiveDocument.SaveAs("c:\test\test.Doc")
'.ActiveDocument.Saved = True
'.Quit()

End Sub

"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:uR******************@tk2msftngp13.phx.gbl...
Hi scorpion53061, till MS rewrites OFFICE in dotnet and provides a dotnet
interface for automating, it is best to stick to VBA or compiled VB6 code
( I would prefer the latter). We do serious office integration and believe
me VB6 is the best option.

Nov 20 '05 #8
I mean get it into a table in word.......right now it is tabbing between
columns. When I tried to write the table (.Tables.Add(r,c) it wiped out the
contents of the page and bombed.

"scorpion53061" <sc************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
well one day for about an hour and a half it was pretty slow so I decided to give this a shot.
It is pathetic admittedly. But hey got to start somewhere.

If anyone can advise me of how to actually get this data into word please
let me know....

Private Sub FillIN()
Dim wordApp As Word.Application
wordApp = CreateObject("Word.Application")
Dim wordDoc As Word.Document
Dim wordRng As Word.Range
Dim wordPara As Word.Paragraph
Dim wordRng1 As Word.Range
Dim wordPara2 As Word.Paragraph
With WordApp
.WindowState = Word.WdWindowState.wdWindowStateMaximize
.Documents.Add()
wordApp.Visible = True
wordDoc = wordApp.ActiveDocument
wordRng = wordDoc.Range
wordRng1 = wordDoc.Range
With wordRng
.Font.Bold = True
.Font.Italic = True
.Font.Size = 14

.InsertAfter("Invoice - Customer 252991")
.InsertParagraphAfter()
End With
wordPara = wordRng.Paragraphs.Item(3)
With wordPara.Range
.Bold = False
.Italic = True
.Font.Size = 14
End With
With wordRng1
.Font.Bold = True
.Font.Italic = False
.Font.Size = 13
paragraphcount = 0
Dim i, r, c As Integer
For i = 0 To Stock11.Tables.Count - 1
'.Tables.Add(wordRng1, 1, c)
For c = 0 To Stock11.Tables(i).Columns.Count - 1
..InsertAfter(Stock11.Tables(i).Columns(c).ColumnN ame & vbTab)
Next
For r = 0 To Stock11.Tables(i).Rows.Count - 1
'.InsertParagraphAfter()
'.Rows.Add(r)
For c = 0 To Stock11.Tables(i).Columns.Count - 1
.InsertAfter(Stock11.Tables(i).Rows(r).Item(c) & vbTab)
'.InsertParagraphAfter()
Next
.InsertParagraphAfter()
paragraphcount = paragraphcount + 1
Next
Next

paragraphcount = paragraphcount + 1
.InsertAfter("Customer 252991")
.InsertParagraphAfter()
' Insert a blank paragraph between the two paragraphs.
.InsertParagraphAfter()
paragraphcount = paragraphcount + 2
wordPara2 = wordRng1.Paragraphs.Item(paragraphcount)

With wordPara2.Range

.Bold = True
.Italic = False
.Font.Size = 13
End With
End With
End With
'.ActiveDocument.SaveAs("c:\test\test.Doc")
'.ActiveDocument.Saved = True
'.Quit()

End Sub

"Nice Chap" <Ni******@PlasmaDyne.com> wrote in message
news:uR******************@tk2msftngp13.phx.gbl...
Hi scorpion53061, till MS rewrites OFFICE in dotnet and provides a dotnet interface for automating, it is best to stick to VBA or compiled VB6 code ( I would prefer the latter). We do serious office integration and believe me VB6 is the best option.


Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mickeydisn | last post by:
Sub: C++ Word automation Extract text hello. I want extact text form a word document using a visual c++ programme. I have see a lot of documentation. and my analysis is that I must use a...
12
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000...
6
by: Colleyville Alan | last post by:
I have an application that has an Access table that stores the locations of slides in a Powerpoint file. This used to work fine when there were about 4 files and 200 slides. The database would...
2
by: kids | last post by:
Does anybody know any reason which could cause Ms. word automation to crash? I try to call word automation to open a document and use find and replace function. For some reason it works but I...
4
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to...
0
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
2
by: Radek | last post by:
Hi, I have got such problem: in my directory "C:\folder" I have 3 files in MS WORD (having tables, images etc), these are: "1.doc", "2.doc", "3.doc". I want to write an application (C# of...
4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
5
by: Daniel Walzenbach | last post by:
Hi, I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed). The preferable solution would be...
10
by: cj2 | last post by:
I open a word template in VB and add values to the bookmarks then save the document as as pdf. When I then go to close the document it pops up a save as dialog box. It's already saved the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.