Using VBA how do set the position of a table I'm creating.

MS WORD

    Next

  • 1. Looking for the a code example for text effects and the consta
    thanks that works but now I'm getting a protection error If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then ActiveDocument.FormFields("DeductibleSIR").Select With Selection.Range.Font .Animation = wdAnimationNone End With End If (on the .animation line I'm getting "This method or property is not available because the object refers to a protected area of the document." ????) I though it is? Thanks! -- Otium Cum Dignatate "Cindy Meister" wrote: > Try typing > Selection.Range.Font. > > And look at the list that appears. "Animation" may be what you're looking for? > -- > -- Cindy > > > "joep3" wrote: > > > (i.e.) > > to turn off marching ants... > > > > activedocument.formfield("Coverage_extensions").select > > selection.endkey font.borders:=wdNone > > > > This info should be somewhere, but I can't find it... > > > > -- > > Otium Cum Dignatate
  • 2. Locking a document
    I have a template which includes formfields. When a document is created from that template and completed. Is it possible to lock the enture document and it's contents to prevent the content being altered without a password? -- Mark
  • 3. Looking for the a code example for text effects and the constants
    (i.e.) to turn off marching ants... activedocument.formfield("Coverage_extensions").select selection.endkey font.borders:=wdNone This info should be somewhere, but I can't find it... -- Otium Cum Dignatate
  • 4. softball league scheduler
    simple league scheduler for softball games Thanx
  • 5. Word 2003 Code to Change Table Column Width
    I apologize if this is a double-post; I received an error when I tried to post. I have a document that has several tables. For the first table in the document which has two rows and two columns, I'd like to be able to adjust the column width of the 2nd column to 2.43" when the paper size is A4. The width is currently set to 2.03" and needs to remain that way letter size paper. Your assistance is greatly appreciated.

Using VBA how do set the position of a table I'm creating.

Postby bG92ZXRhYmlrZQ » Wed, 17 Sep 2008 00:29:03 GMT

I'm using the following to create a table.

Set tblNew = docActive.Tables.Add( _
        Range:=docActive.Range(Start:=0, End:=0), NumRows:=2, _
        NumColumns:=3)

How do I change the location of the table? If I put values in Start and End 
I get an app error, value out of range. I used 5 for both Start and End.


RE: Using VBA how do set the position of a table I'm creating.

Postby U3RldmVuTQ » Wed, 17 Sep 2008 01:28:19 GMT

To: Lovetabike,

I found the following macro to work fine.

Sub testaddtable()
    Dim docActive As Document
    Set docActive = ActiveDocument
    
    Set tblNew = docActive.Tables.Add( _
        Range:=docActive.Range(start:=5, End:=5), NumRows:=2, _
        NumColumns:=3)
End Sub

But I ran it on a document which had more than five characters. So I would 
assume that you ran it on  a document which had less than five characters. If 
so, that would be your problem.

The following macro adds five lines and then adds a table.

Sub testaddtableVer2()
    Dim docActive As Document
    Dim oRange As Range
    
    Set docActive = ActiveDocument
    Set oRange = ActiveDocument.Range
    
    oRange.InsertAfter vbCr & vbCr & vbCr & vbCr & vbCr
    oRange.Collapse CollpaseEnd
    
    Set tblNew = docActive.Tables.Add( _
        Range:=oRange, NumRows:=2, NumColumns:=3)
End Sub


Steven Craig Miller





RE: Using VBA how do set the position of a table I'm creating.

Postby bG92ZXRhYmlrZQ » Wed, 17 Sep 2008 02:15:03 GMT

Perfect!






Similar Threads:

1.Positioning Data in Indivisual Cells within a Table using VBA

I am importing data from an AS/400 using OLE DB/ADO and wish to
populate a table with data.

I am reading a Primary file which has header information, and I need
to load detail from two additional files into the Table.  The number
of rows within the table must be variable.

I would like to control loading the table by cell.  For example, load
Name in Row 1, Column 1, Amount #1 in Row 1, Column 2, Amount #2 in
Row 1, Column 3, Total in Row 1, Column 4....then read the next record
and start loading in Row 2...and so on.

So, my question is this; How do I load data into cells of a table and
allow the table to be a variable length?

Thanks,

Romine

2.Move Position of Table using VBA

I have a word document that is created from Access which has 2 tables which 
are both extendable to a number of rows dependant on nthe contents of the 
query in access.

The data passes fine from Access to word, however as the first table grows 
the second table over writes the last rows of the first.

Is there a way that I can use VBA (Called in Access) to move the position of 
the second table to avoid overrighting of the last rows in the first table.

-- 
Many Thanks for your time

Alan

3.Positioning Data in Indivisual Cells within a Table using VBA

I am importing data from an AS/400 using OLE DB/ADO and wish to
populate a table with data.

I am reading a Primary file which has header information, and I need
to load detail from two additional files into the Table.  The number
of rows within the table must be variable.

I would like to control loading the table by cell.  For example, load
Name in Row 1, Column 1, Amount #1 in Row 1, Column 2, Amount #2 in
Row 1, Column 3, Total in Row 1, Column 4....then read the next record
and start loading in Row 2...and so on.

So, my question is this; How do I load data into cells of a table and
allow the table to be a variable length?

Thanks,

Romine

4.can anyone see what i'm doing wrong Access 2002 frend end VBA - SQL Server 2002 backend

Hi all

I think I'm missing something, but I cant figure out what. Can anyone offer
any help?

I KNOW I have lots of records, some with FK_Site_details_idx = 1 and others
with a value of 4250 (plus many others, but these are the 2 i'm intersted in
my test data)

What I do is bring back the record with the highest date i.e. the last one
inspected that was a battery inspection


so for FK_Site_details_idx = 1 I use

rst.Open "SELECT FK_Site_details_idx, MAX(tbl_report_index_inspection_date)
AS inspection_date, tbl_report_type FROM dbo.tbl_report_index GROUP BY
FK_Site_details_idx, tbl_report_type having (FK_Site_details_idx = 1) AND
(tbl_report_type = 'battery')"

this works exactly as I would expect

now I try for FK_Site_details_idx = 4250 (knowing this data exists) using

rst.Open "SELECT FK_Site_details_idx, MAX(tbl_report_index_inspection_date)
AS inspection_date, tbl_report_type FROM dbo.tbl_report_index GROUP BY
FK_Site_details_idx, tbl_report_type having (FK_Site_details_idx = 4250) AND
(tbl_report_type = 'battery')"


nothing is returned. The odd thing is, if I paste the SQL into a view, it
works and returns the correct value

can anyone see what it is I'm doing wrong

many thanks

Andy


5.How do I lock down text positions in Word when I'm creating a form

I've changed the properties of the fill-in to limited from unlimited but 
nothing seems to work.

I have two fields on one line, separated with tabs. When I complete the 
first fill-in, the second field moves to the right.

Please help.

Thanks.

6. Set position into a worksheet using vba

7. Make Table in Back End using VBA code is not creating the table

8. how to create an dynamic data table/chart in word using vba



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 88 guest