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




Cell Numbering In Word 2007


i have 7 columns
and 98 rows

when i add numbers i each cell then it wil give me

1 2 3 4 5 6 7
8 9 10 11 12 13 14
and so on


but i want the numbers as follow

7 6 5 4 3 2 1
14 13 12 11 10 9 8
and so on

how can i create it in word 2007 ?



Edited by - Johnnyd1963 on 8/3/2008 8:48:46 PM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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)

Bullets And Numbering In Word
How to set hte bullets and numbering from the number I want to start
I used

Code:
theDoc.Range.ListFormat.ApplyListTemplate ListTemplate:=lFormat, ContinuePreviousList:=True, ApplyTo:=wdListApplyToSelection
but it start numbering from 1
Let's say I want to start from 4, how to solve it?

thank you

Auto Numbering In Word
Is it possible to add an auto numbering system to a word document, so that each time the document template is filled in, it will automatically add a number? This is a complaint form, which will be printed as well as saved to a file. Although this question does not have a great number of points, I really need an answer ASAP. Thanks for all of your help.

AJL

Word Document Sequential Numbering
Hello

I need to reformat a tracking form that is almost completely filled in by hand. The manager wants a field in the form to be assigned a sequential number each time that it is printed out. Should I use a field, a macro or vba for word?

Word Wrap With Line Numbering
I am writing an html highlighting control and i have wrod wraping and a line numbering skema in it. what happens now is that when i have ti wrap text it adds the line number for every wraped lin. what i would ultimatly like it to do is check the end of each line for a carage return/line feed and if it is found add a new line number but if is is not found then just add a space or something to specifif that a part of line is there rather than a new line.

I'm not sure how i would do this so if anyone know how i could get started on this it would be very appricated.

Thanks in advance.

Sid

here is my line number code.


Code:
Public Function LineCount() As Long
' return the total line count of the code window
LineCount = SendMessage(RichTxtBox.hwnd, EM_GETLINECOUNT, 0, 0)
End Function
Public Function CurrentLine() As Long
CurrentLine = SendMessage(RichTxtBox.hwnd, EM_LINEFROMCHAR, RichTxtBox.SelStart, 0) + 1
End Function

Private Sub WriteLineNumbers()
Dim x As Long
Dim lStart As Long
Dim FontHeight As Long
Dim lFinish As Long
Dim lCurrent As Long

lStart = SendMessage(RichTxtBox.hwnd, EM_GETFIRSTVISIBLELINE, 0, 0) + 1
lCurrent = CurrentLine
With picLines
.Cls
FontHeight = .TextHeight("12345")
.CurrentY = Screen.TwipsPerPixelY * 1
.CurrentY = .CurrentY + 15
lFinish = (RichTxtBox.Height / FontHeight) + lStart
If lFinish > LineCount Then lFinish = LineCount

' loop from the first visible line in the rtb to the end of the page
For x = lStart To lFinish
If x = lCurrent Then
.FontBold = True
Else
.FontBold = False
End If

picLines.Print Right$(" " & x, 5)
Next x
End With
End Sub

RTB Line Numbering With Word Wrap
I am wondering if any one can help me with this. I am working an advance text editor and i want it to to line number like this when it is word wraped

1
-
-
2
-
3
4
5
-
-

what the '-' is for is when the line wraps i dont want it to number it with the following number i want it ot be a '-' and i dont want it to show the number until the line is actually anew line. my code that i have words when your on line one but once you start scrolling it get off set beacause i am using an api call to get the first visible line. below is my sub that i use to write the line numbers with.

Code:
Private Sub WriteLineNumbers()
Dim y As Long
Dim x As Long
Dim lStart As Long
Dim FontHeight As Long
Dim lFinish As Long
Dim lCurrent As Long

lStart = SendMessage(RichTxtBox.hwnd, EM_GETFIRSTVISIBLELINE, 0, 0) + 1
lCurrent = CurrentLine <-- calls an api function
y = 1
With picLines
.Cls
.Font = RichTxtBox.Font
FontHeight = .textHeight("12345")
.CurrentY = Screen.TwipsPerPixelY * 1
'.CurrentY = .CurrentY + 15
lFinish = (RichTxtBox.Height / FontHeight) + lStart
If lFinish > LineCount Then lFinish = LineCount ' LineCount is the api call in a function
y = lStart
' loop from the first visible line in the rtb to the end of the page
For x = lStart To lFinish
If x = lCurrent Then
.FontBold = True
Else
.FontBold = False
End If
' check for wordwrap
If WordWrap Then
If GetLine(x) Or x = 1 Then
picLines.Print Right$(" " & y, 5)
y = y + 1
Else
picLines.Print Right$(" -", 5)
End If
Else
picLines.Print Right$(" " & x, 5)
End If
Next x
End With
End Sub
RichTxtBox is a richtext box and picLines is a Picture Box.

Thanks,

Sid

Page Numbering In Word... Help Meeeee
is there anyway of controlling page numbers in word.. i am using vba environment in word.
my word file consists of sections.
each section has some pages.
page numbering should be of the format page x of y
where x starts from 2,3.. for each section starting from 2.
i.e, section1,second page should have 2 of y
section2 second page should have only 2 of y.
where y is the tot number of pages of each section.
pls iam sitting with this for a week... please help me......
i am using word 97.
tried autoentry page x of y but it is displaying wrongly.

'for x
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
'for y
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldSectionPages

pls help meeeeeee.......

Using VBA To Insert Page Numbering In Word 2003
Hi all

I'm trying to automate the insertion of page numbers into a template via a VBA macro in MS Word 2003.

I currently have a macro which deletes header and footer information, including the page numbers. So... I need the page numbers to be re-inserted in a non-standard position in the template (i.e. to the far right and halfway down the page). At the moment I have only been able to insert the pages in the footer with standard left/right alignment etc.

Does anybody know how I can set the position I would like the page numbers to appear in the template? I'm really trying to automate the manual process of grabbing the page number and dragging and dropping it at the desired position on the page.

I have been looking around for answers, but I haven't done any VBA programming in a while so I thought I might try here

Any help would be *much* appreciated.

Thanks in advance
mang

COM Add-in On Word 2007 - Vista
Hey guys,

I am having an issue with COM addins also with Office 2007. Mine is a problem on XP with Office 2007 and Vista with Office 2007. What happens is I have an addin that adds a menu item also. This menu item then has a drop down list of 5 things. When the user clicks the menu item that was added by the addin, Word errors with Word has encountered a problem and needs to close. Any ideas? It works as planned in earlier versions of office. Thanks for any help.

COM Add-in On Word 2007 - Vista
Hello,

I have a COM DLL tool that build a customized toolbar with some options in it. It works great on Word 2000,2002 & 2003. I have tried to install it on Word 2007 that is on Vista and I got the custom toolbar and it works. The problem is I got another toolbar that is called "Menu Commands" (screen shot attached) and in it there are two "General" menus! Those two menus did not appear in any of Word 200-2003. The content of the General menu mimic one of the other customized menus in my toolbar.

The code is about 15K (not well documented) lines (parts of the code is totally not documented)! I am finding it hard to debug because of the events. I have spent two days trying to understand from where is this new "Menu Commands" coming from but until now I have no idea!

Any advice on how to debug it in a better way is welcomed.

Thanks in advance,

- George

AppActivate On Word 2007
Hi All,

I have an AppActivate statement in my VB Code to acivate Microsft Word, it works for all flavours of word and operating system, but it fails on Vista with Word 2007.

here's the line which causes error:

WordBasic.AppActivate "Microsoft Word", 1

Kindly help me in figuring out possible reason behid it's failure.

Thanks

CreateNewDocument In Word 2007
When calling CreateNewDocument with the label name of 5160 from vb the word uses the wrong 5160 (It takes the one from Avery with continuous printer).

Does any one have any updated code that will work with any version of word?

Need Help With Macros In Word 2007
I know almost nothing about Visual Basic, but I need to write a macro in MS Word 2007 that will insert paragraph returns after the text "Cd" , "Hg" , "Pb" , "Cr". Can anyone help? This is what I have so far (I know it isn't pretty and it definitely doesn't work). Any help would be greatly appreciated. Thank you!


Sub Results()
'
' Results Macro
'
'
Do While selection.Find.Execute(FindText:="Cd") = True
selection.InsertParagraphBefore

Loop

End Sub

How To Disable Tab Bar In Word 2007 Using Vb6?
Hello,

My program used to work in all the versions of Microsoft Office upto 2003. But it does not work in Office 2007.

I want to disable Tabs (i.e. Menu bars in old office). and even short cuts like (Ctrl + S), etc.

Can anyone help me on this?

Its very Urgent.

Thanks in advance.

How To Export Listbox Items To Word With Bullet And Numbering
Hi....
I want to export data from a listbox to MS Word.....
I am, however, able to get help from this forum on how to export data to MS Word, I need to insert bullet and numbering before each line exported to MS Word.
e.g.
i have list items like....CAT,DOG,CAMEL...
i want to export them asCATDOGCAMEL
Any help will be greatly appreciated.....Thanx

AutoExec Is Not Working In Word 2007
Hi All,

Am working on Office word 2007. I want to call function when the word file is opened as add-in or when the file is double clicked. So I used AutoExec method in a module as this willl be called first when the file is opened. But when double clicked on the .dotm or .docm file netither AutoExec nor AutoOpen are not called.

I tried saving the file in both .dotm and .docm.

So please advice me how I can accomplish this.

VB6, MailMerge, Word 2007, Headaches.
Is the Microsoft Word 12 Object Library uncompatible with earlier versions of the object library? We have a mail merge application that worked on XP/Office 2003 Word fine. It created 5160 Avery labels, however, when I run the exact same code with Office 2007 installed, I get 4 columns of labels instead of 3, and the 4 columns is not Avery 5160 format.

I've duplicated this using code straight from Microsoft:

This code is basically the same thing we do for Office 2000 - 2003.

Here's the code block:

Code:
Private Sub Command1_Click()

Dim oApp As Word.Application
Dim oDoc As Word.Document

'Start a new document in Word
Set oApp = CreateObject("Word.Application")
Set oDoc = oApp.Documents.Add

With oDoc.MailMerge

'Insert the mail merge fields temporarily so that
'you can use the range that contains the merge fields as a layout
'for your labels -- to use this as a layout, you can add it
'as an AutoText entry.
With .Fields
.Add oApp.Selection.Range, "Contact_Name"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "Address"
oApp.Selection.TypeParagraph
.Add oApp.Selection.Range, "City"
oApp.Selection.TypeText " "
.Add oApp.Selection.Range, "Postal_Code"
oApp.Selection.TypeText " -- "
.Add oApp.Selection.Range, "Country"
End With
Dim oAutoText As Word.AutoTextEntry
Set oAutoText = oApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", oDoc.Content)
oDoc.Content.Delete 'Merge fields in document no longer needed now
'that the AutoText entry for the label layout
'has been added so delete it.

'Set up the mail merge type as mailing labels and use
'a tab-delimited text file as the data source.
.MainDocumentType = wdMailingLabels
.OpenDataSource Name:="C:data.txt" 'Specify the data source here

'Create the new document for the labels using the AutoText entry
'you added -- 5160 is the label number to use for this sample.
'You can specify the label number you want to use for the output
'in the Name argument.
oApp.MailingLabel.CreateNewDocument Name:="5160", Address:="", _
AutoText:="MyLabelLayout", LaserTray:=wdPrinterManualFeed

' oDoc.Compatibility (wdUseWord2002TableStyleRules)


'Execute the mail merge to generate the labels.
.Destination = wdSendToNewDocument
.Execute

'Delete the AutoText entry you added
oAutoText.Delete

End With

'Close the original document and make Word visible so that

'the mail merge results are displayed
oDoc.Close False
oApp.Visible = True

'Prevent save to Normal template when user exits Word
oApp.NormalTemplate.Saved = True

End Sub



Attached you will find two merged files. One is a Office 2003 Mail Merge, you'll notice 3 columns in the format of 5160, the second is what the solution above creates in Office 2007, notice 4 columns.

So is there a way to modify the code block above to tell Word to do the mail merge in 2003 Compatible mode?

Word 2007 - Loop At Controls In Document
Hi,

I have to mention that this is my very first experience coding VBA in Word.

I have a word 2007 document which has many Checkboxes, Optionbuttons and Labels.

When I Check/Uncheck a checkbox, it has to set specific labels caption depending on their names.

In VB I loop at Me.Controls() and TypeOf label...

But I do not see that in Word.

I do not use à UserForm, I just use a Word Document.

Thank you for helping.

How To Hide Word 2007 Title Bar / Ribbon
Dear All,

We currently use word in our application. We hide the title bar of word and display it in a ActiveX control (just the textual area). We use the below API for hiding the title bar.

==============================================
Public Const GWL_STYLE = (-16)
Private Const GWL_PARAM = 394264704

SetWindowLong(mlngWordHwnd, GWL_STYLE, GWL_PARAM)
==============================================

It works fine with Word 98, 2000 & 2003. With Word 2007 the title bar is not getting hidden with the above API. It has a new concept called "Ribbon". It would be really useful, if any solution is provided for hiding the title bar & Ribbon from Word 2007.

Regards,
Suresh

How To Open/Read An Access 2007 (accdb) From Excel 2007
Hi All,

My company is moving to Office 2007. I am going through several hundred macros written in Excel 2003 to make sure they work in 2007.
I am trying to open and read an Access 2007 database (extension .accdb) from within Excel VBA.
What used to work was this:

Code:
Dim dbLocal as Database
Set dbLocal = Workspaces(0).OpenDatabase("C:MyDatabase.mdb")
When I run this under 2007 and change the Access database extension to .accdb, I get this error:

Quote:




Run TIme Error 3343
Unrecognized Database Format




I've tried adding extra References in, but no luck. Any help would be greatly appreciated.

Cheers,

Paul

Importing A Date Function From Excel 2007 To Access 2007
hi, I have a major project ahead of me, I am creating a Dbase full of maintenance records in Access 2007. This Dbase is supposed to be able to calendarise routine maintenance and also on-the-spot maintenance so that all our vehicles don't miss out on it. Is it necessary to link Access with Excel so that each time maintenance is performed, Excel tells Access when it needs to be done next time, or is there another way that's much simpler only using Access 2007? I'm new to Access and Visual Basic so simplest explanations are best...thanks in advance.

I Will Compensate For Any Help With A Macro Recording Issue I Am Having With Word 2007
Summary of my issue:
I have two tables in a document. I would need a macro button that would open another document and copy and paste those tables in it, in specific locations. Any help is very appreciated. I will pay for time. Email wgallo2337@aol.com

Enable/disable Custom Ribbom In Word 2007 Dynamically Using VBA
Hi All,

I am working on Word 2007 VBA. Am able to add Customized tab to the Word 2007 ribbon by using customUI.xml. However I would like to enalbe or disable some of the items on my cusotm tab dynamically thru VBA. Also I want to the customized ribbon item to be removed when I click a item.

Please advice me how I can accomplish the above mentioned task.

Regards,
Abhi.

&"Curing&" Word's List Numbering With VBA
Hey everyone, I am using VBA to generate documents with lists that must then be cut and pasted into another Word document (there is NO way aroud this). Unfortunately, some of these lists are nested and so cutting-and-pasting often screws them up, and then I lose all the time I saved by using a VBA form

Soo I came across a very helpful and extensive website:

http://word.mvps.org/FAQs/Numbering/WordsNumberingExplained.htm

which within it has a link to another article, "How to cure Word's List Numbering with a dose of VBA", http://word.mvps.org/FAQs/Numbering/CureListNumbering.htm , BUT THE LINK DOESN'T WORK. It hasn't worked every time I've tried in the last couple of months, even after emailing the webmaster.

So rather than me banging my head on my desk and continually hitting refresh on that site, does someone have a copy of the information contained there or can someone explain how it is done? I will be eternally grateful!

Word - Which Cell Is The Caret In?
Hello,

I'm workingon a small project using VBA in Word 2003. I have a document containing a table. What I'm wanting to do is insert some text at the end of which ever cell the Caret is in.

How whould i workout where it is?? Or is there a way to use .SelEnd and move it to the end of the cell?

Thanks

Getting Text From A Cell In Word
Hello, just wandering how can I get text from a cell and assign it to a variable in word.
Thx

Cell Format, Determining Type Of Cell Content (string/real/integer) And Cell Size
I am not sure whether I am at the right forum, but I am exporting Excel values in a Word document.

Unfortunately -my copy paste action doesn't take in account the cell_properties, so in some cases a value of 9,9999999999999999999999999999998E-4 is entered instead of the 9,9 E-4 or even 0,001 that is shown in the excel sheet.

I'm having trouble with finding the set format command (e.g. Tutbo Pascal: write(value:8:3) -or someting) and I also have strings in these cell -I am not sure if it gives any problems if one sets every zell to 2 decimals, if so -ho can I determin the type of cell content ...
And how to set the cell size to size of content

Could anyone help me, I 'm much obliged

How To Get The Aligment Of A Table Cell In Word
Hi,

I have written a macro, which traverses the table of a word document and outputs the text in particular format to a text file. While doing so i need to retain the look of the table and for which i need to know the aligment of the cells in the table whether centered, left or right aligned.

Is there any means by which this be achieved?

Thanks
Niranjan

Getting Cell Alignment Of A Table In Word
Hi,

I have written a macro, which traverses the table of a word document and outputs the text in particular format to a text file. While doing so i need to retain the look of the table and for which i need to know the aligment of the cells in the table whether centered, left or right aligned.

Is there any means by which this be achieved?

Thanks
Niranjan

Use Cell Content To Populate Word Doc
hello
How can I get certain cell values from each row to make address list in word document
for example cells a1, c1, e1, f1, h1
then write these in word in proper layout for address
then loop through replacing 1 with 2 and so on (there are 3500 rows to do)
plese help

Copy A Cell To A Word Table
This type of topic has been going around a lot lately. I have been searching the forum, but am still lost on the subject. I have taught myself VBA in Excel and feel very comfortable with that. However, I know need to copy a cell(s) to a word table and am having a great deal of trouble with this. Can't seem to get it through my thick skull I guess. BTW have done a google search as well. Anyway, here is the story...

I have a sales worksheet that is filed out when an admin person answers the phone. The worksheet contains basic information...name address reason for call and the like. If the sale goes through I need the name and address copied into word for the contract (a lot double typing that can be typed once...push a button and presto; all of the fields in word are copied over). Anyway, if someone could spell this out for me, it would be a huge help. Thanks for the help in advance.

-JD

Selecting A Whole Cell In A Word Table
Hi there.

I'm struggeling with the following:

I have a Word document with 2 columns. It contains 100 rows, which gives a total of 200 cells.
One of the rows are looking something like this:
_______________________________
|________________|______________|

In my code, I'm able to locate/find the correct row I want to do my selection.
I have a bookmark (called "Labelx" where x is the number of the cell) in every cell.
I'm able to select the first cell (that is the cell to the left), and I'm also able to put my cursor in the next cell (the one to the right).

The big challenge is to "mark"/highlight/select the cell to the right.
The purpose is that I want to select this cell and delete all the contents in it.

Can anyone give me some direction?

So far I have this code:
BookM = "Label" & (i+2) 'This selects the bookmark in the row below the row I want to delete
ActiveDocument.Bookmarks(BookM).Range.Select
Selection.MoveUp Unit:wdLine, Count:=1
Selection.EndKey Unit:=wdStory, Extend:= wdExtend
Selection.Delete

This code, selects all the remaining rows in the documents and deletes them. This is my purpose.
But I also want the code to delete the cell to the right in the last row AFTER deleting the remaining rows.

Hope that my explaination is good enough, if not - give me a hint and I will try to improve.....

Separating The Last Word In Each Cell In A Column
Is there anyway to separate off just the last word in each cell in a column. Some cells have two words and some have three of four, so I'm not sure if Text to Columns can do it. Thanks

Selecting Part Of Cell In Word
Hello,

in my application i send a pricelist to word.
It's placed in a table.
Now i want to select a part of the first cell in the row and set it bold.
Is this possible and how would you do it.

For example:
new
vbcr
article1

I want to put "new" in bold.

???

Colspan Of Table Cell In MS Word
Hi,

I'm wondering how my Macro can determine if a table cell in MS Word spans multiple columns and if so how many.

thanks in advance

Word Tables Cell Properties
I need to isolate the following information on each cell of a Word table but I can't see where these properties may be found:

1) The amount of columns that the cell spans
2) Which column numbers (index) they span

Any ideas anyone...

Neil

MS WORD XP Table Cell Sizes
Hey there

I'm writing an application that reads data from a mutlidimensional array into tables in a word document. I've got it up and running with MS Word 2000, but with MS Word XP, some of the cell sizes on the tables are wrong.

anyone else run into something like this ?!?

oh btw. its not really VBA its in VB (using WORD10 library).

thanks in advance.

Merge Cell Problem In Word Tables....
Hi, all i have a strange problem with Merge cell.

I use the codes below to merge a cell (Cell A) with another cell (Cell B) just above it.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""
Doc.Tables(1).Rows.Add

'n is the row number just created, the codes below just for n >2
Doc.Tables(1).Cell(n,1).Select
Selection.SelectCell
Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Cells.Merge

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""

It works perfect if height of Cell B is no more than one page.
I generate the table row by row and merge the Cell A with Cell B.

That is why the height of Cell B can upto 2 or 3 pages.
The error message is that :
"Selection.Cells.Merge" is an invalid command. (something like that)


Any idea on this problem ?

Sami.

Word Creation - Table Cell Alignment
Hello everybody,

I am trying to create an MS word document automatically through VB. In that document, there should be a table. The table should have 4 columns. The data in the last two columns needs to be right aligned. I could create table and fill it with data from table. But I am not able to right align contents of 3rd and 4th columns of the table. Could anybody please help me ?

I am attaching the code I wrote(A part of it I got from net)

Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table
Dim oTitle As Object
Dim iCount As Integer
Dim intYCount As Integer
Dim intXCount As Integer
Dim bCreateOrGot As Boolean
Dim intXMax As Integer
Dim intYMax As Integer
Dim strTitle As String

strTitle = "My word document"
Dim rstTable As ADODB.Recordset
Dim qryTable As String
qryTable = "SELECT artisteid,productionname, grossamount, (grossamount*17.5/100) as vat FROM artistevouchers"
Set rstTable = New ADODB.Recordset
rstTable.Open qryTable, cnnArtists, adOpenDynamic

intYMax = rstTable.Fields.Count
rstTable.MoveLast
intXMax = rstTable.RecordCount + 1
rstTable.MoveFirst
On Error Resume Next ' Defer error trapping.
bCreateOrGot = True
Set oWord = New Word.Application
bCreateOrGot = False
err.Clear ' Clear Err object in case error occurred.
If bCreateOrGot = False Then
With oWord
.Visible = True
.Documents.Add ("c:project
eceipt.doc")
End With
End If
Set oDoc = oWord.ActiveDocument
On Error GoTo 0
If bCreateOrGot = True Then
With oDoc.Application.Selection
.InsertBefore Text:=strTitle & vbCrLf
With .Find
.Text = "^l"
With .Replacement
.Text = ""
End With
.Execute Replace:=wdReplaceAll
End With
With .Font
.Bold = True
.Name = "Arial"
.Size = 8
End With
.MoveRight Unit:=wdCharacter, Count:=1
.InsertAfter Text:=vbCrLf
End With
Set oTable = oDoc.Tables.Add(Range:=Selection.Range, NUMROWS:=intXMax, NumColumns:=intYMax)
Else
With oDoc.Application.Selection
.InsertBefore Text:=vbCrLf & strTitle
Dim iloop As Integer
With .Find
.Text = "^l"
With .Replacement
.Text = ""
End With
.Execute Replace:=wdReplaceAll
End With
With .Font
.Bold = True
.Name = "Arial"
.Size = 8
End With
.MoveRight Unit:=wdCharacter, Count:=1
End With
Set oTable = oDoc.Tables.Add(Range:=oDoc.Range(Start:=17, End:=17), NUMROWS:=intXMax + 1, NumColumns:=intYMax)
End If

For intYCount = 0 To intYMax - 1 'Add headings

With oTable.Cell(Row:=1, Column:=intYCount + 1).Range

.InsertAfter Text:=rstTable.Fields(intYCount).Name
End With
Next
intXCount = 2
Dim f_total_gross_amount As Currency
Dim f_total_vat As Currency
f_total_gross_amount = 0
f_total_vat = 0

Do Until rstTable.EOF
oTable.Rows.Add
For intYCount = 0 To intYMax - 1
With oTable.Cell(Row:=intXCount, Column:=intYCount + 1).Range
If Not IsNull(rstTable.Fields(intYCount).Value) Then
Dim str_value As String
If (intYCount = 2) Then
f_total_gross_amount = f_total_gross_amount + rstTable.Fields(intYCount).Value
End If
If (intYCount = 3) Then
f_total_vat = f_total_vat + rstTable.Fields(intYCount).Value
End If
If (intYCount = 2 Or intYCount = 3) Then
str_value = String(12 - Len(CStr(rstTable.Fields(intYCount).Value)), Chr(32)) & Format(CStr(rstTable.Fields(intYCount).Value), "#0.00")
Else
str_value = CStr(rstTable.Fields(intYCount).Value)
End If
.InsertAfter Text:=str_value
Else
.InsertAfter Text:=""
End If
End With
Next intYCount
intXCount = intXCount + 1
rstTable.MoveNext
Loop
oTable.Rows.Add
With oTable.Cell(Row:=intXCount, Column:=2).Range
.InsertAfter Text:="Total"
End With
With oTable.Cell(Row:=intXCount, Column:=3).Range
.InsertAfter Text:=Format(CStr(f_total_gross_amount), "##########0.00")
End With
With oTable.Cell(Row:=intXCount, Column:=4).Range
.InsertAfter Text:=Format(CStr(f_total_vat), "##########0.00")
End With

oTable.AutoFormat Format:=wdTableFormatGrid8, ApplyBorders:=True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows:=True

oTable.Select

With oDoc.Application.Selection
.Collapse Direction:=wdCollapseStart
.InsertParagraph
.Collapse Direction:=wdCollapseStart
End With

Set oTable = Nothing
Set oDoc = Nothing
Set oWord = Nothing

Limit The Number Of Charachters In A Word Cell
Hello!

I am working on a word template, and I want to limit the number of charachters the users can put in each cell.

Can this be done in a word table?

tnx

noccy

Create Textbox In Every Cell From A Word Table
Hallo everyone,

I have a table wich contains texts and images in every cell, I would like to select everything is in a cell and put it in a textBox,so I will have a textbox for every cell.

I try this

Count = 1
For currRow = 1 To (Selection.Tables(1).rows.Count)
For currCol = 1 To Selection.Tables(1).Columns.Count

Selection.GoTo What:=wdGoToBookmark, Name:="Bookmark_" & Count
Selection.Tables(1).Cell(currRow, currCol).Select
Selection.CreateTextbox
Selection.ShapeRange.Line.DashStyle = msoLineDash
Count = Count + 1

Next currCol
Next currRow

But I have an error anyone could help me?
Thany you.
Adelin

Makeing One Word (or More) In A Flexgrid Cell A Different Color
Does anyone know a way to make one or more words (not all of the words) in a cell of a flexgrid to be a different color. I know that there is the .CellForeColor property, but that changes all of the words in the cell. I want to change just one (or even more than one) a different color than black (but leave others black)... does that question even make sense?

Selecting Text In A Word Table Cell
This has probably been answered many times before but I can't find the solution. I need to insert some text into a Word table and then change the font without affecting the text that was already in the cell. My code will look something like this:


Code:
Set oWord = CreateObject("Word.Application")

' Create a new Word document based on works_oder.dot template
oWord.application.Documents.Add App.Path & " emplatesworks_order.dot"
oWord.Visible = True
oWord.Activate

With oWord.ActiveDocument.tables(1) ' First table in Word template
.cell(1, 2).range.insertafter "Temp 0001"
.cell(2, 1).range.insertafter " " & cmbCustomers
.cell(2, 2).range.insertafter vbCrLf & txtDrawingNo
.cell(2, 4).range.insertafter vbCrLf & txtWorksOrderNo
.cell(3, 1).range.insertafter " " & txtCustOrderNo
.cell(4, 1).range.insertafter vbCrLf & txtRequiredBy
.cell(4, 2).range.insertafter vbCrLf & txtDescription
End With


I guess I need to select the text I've just added and then apply the font formatting I need, but I can't quite work out the syntax to select just the new text and exclude the original contents of the cell. Thanks!

Word 97 - Bookmarks/table Cell Refs
Hi

I know how to create a simple bookmark in Word using VB, but is there a way to tell it to find a table cell ref and create the bookmark?



Thanks

Pendle

How To Retrive An Image From A Table Cell Of Word Doc
hi friends,

i have inserted an image using the following code-
wdapp.ActiveDocument.Range.InlineShapes.AddPicture("c:image1.gif")


how should i retrieve this image into a picture box without losing the quality of the image,

i have tried with the
range.copy
picture1.picture=clipboard.getdata

i got the image but the image quality is very poor!!

HELP ME OUT PLEAAZZZZZZ..

THANX.

How To Retrive An Image From A Table Cell Of Word Doc
hi friends,

i have inserted an image using the following code-
wdapp.ActiveDocument.Range.InlineShapes.AddPicture("c:image1.gif")


how should i retrieve this image into a picture box without losing the quality of the image,

i have tried with the
range.copy
picture1.picture=clipboard.getdata

i got the image but the image quality is very poor!!

HELP ME OUT PLEAAZZZZZZ..

THANX.

Word Table: Mixed Cell Widths ?
Please, help in this situation.
My Word-table has some splitted cells in a header.
I try to insert data to lower cells. But I have the message "Cannot access individual columns in this collection because the table has mixed cell widths. How to work with a table of such kind?
Thanks.

How Do I Make A Portion Of Text In Word Cell Bold?
I've created a word template with a table in it.

In one cell I am entering multiple lines. I'd like the first line (the name) to be bold.

I'm using asp and cannot figure out the correct property to call.

Here is part of the source code:


Code:
Set objWord = CreateObject("Word.Application") ' Create a Word object.
Set WordDoc = objWord.Documents.Add("C:Incident.dot") ' Start a document.
objWord.Application.Visible = False

With WordDoc
Open recordset here

Code:
Do While Not rsPeopleList.EOF
.Tables(7).Cell(row, col).Range.InsertAfter (rsPeopleList("LastName") & ", " & rsPeopleList("FirstName") & " " & rsPeopleList("MiddleName"))
.Tables(7).Cell(row, col).Range.InsertAfter (vbcrlf & vbcrlf)
If rsPeopleList("EmployeeRole") = "" Then
.Tables(7).Cell(row, col).Range.InsertAfter (vbcrlf)
Else
.Tables(7).Cell(row, col).Range.InsertAfter (rsPeopleList("EmployeeRole") & vbcrlf)
End If
.Tables(7).Cell(row, col).Range.InsertAfter ("Employee Number:" & vbTab)
If rsPeopleList("EmployeeID")="" Then
.Tables(7).Cell(row, col).Range.InsertAfter (vbcrlf)
Else
.Tables(7).Cell(row, col).Range.InsertAfter (rsPeopleList("EmployeeID") & vbcrlf)
End If
...

Thanks,

Julie

Fill Text Box In Word With Data From Excel Cell
Hi,

I have a very simple problem (I hope it is simple):

I have a Text Box in Word with no text entered.
In Excel (Sheet 1, Cell A1) is a text, e.g. "Hello World".

In Word I would like to fill the Text Box with the cell of Excel A1.

Can someone post a simple macro of how to achieve this?

On top of that, is there a way to create Text Boxes dynamically in Word and position each created text box?

Thanks in advance!

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