Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 03-28-2016, 02:30 PM
macropod's Avatar
macropod macropod is offline Adding tables to Created word document whilst other word document open Help Windows 7 64bit Adding tables to Created word document whilst other word document open Help Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code works fine for me, though I note you're still not structuring your code consistently. For your own benefit, at least, you really need to address that.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #17  
Old 03-28-2016, 03:13 PM
rpb925 rpb925 is offline Adding tables to Created word document whilst other word document open Help Windows 7 64bit Adding tables to Created word document whilst other word document open Help Office 2010 64bit
Novice
Adding tables to Created word document whilst other word document open Help
 
Join Date: Mar 2016
Location: Sydney
Posts: 17
rpb925 is on a distinguished road
Default

Is it the borders code that is inconsistent. I would like to make the code as good as possible. Not sure what you mean by inconsistent.
Reply With Quote
  #18  
Old 03-28-2016, 03:26 PM
macropod's Avatar
macropod macropod is offline Adding tables to Created word document whilst other word document open Help Windows 7 64bit Adding tables to Created word document whilst other word document open Help Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by rpb925 View Post
Is it the borders code that is inconsistent. I would like to make the code as good as possible.
Well, since you've set them all to 'none', I can't imagine what they're not consistent with.
That said, you could replace all of:
Code:
        .ApplyStyleLastRow = False
        .ApplyStyleFirstColumn = True
        .ApplyStyleLastColumn = False
        .ApplyStyleRowBands = True
        .ApplyStyleColumnBands = False
        .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
        .Borders(wdBorderRight).LineStyle = wdLineStyleNone
        .Borders(wdBorderTop).LineStyle = wdLineStyleNone
        .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
        .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
        .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
        .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
        .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
        .Borders.Shadow = False
with:
Code:
        .Borders.Enable = False
Quote:
Originally Posted by rpb925 View Post
Not sure what you mean by inconsistent.
Well, the following hardly follows a decent visual structure:
Code:
      With wdTbl
                     ...
 
       With .Columns(1)
       .PreferredWidthType = wdPreferredWidthPoints
     .PreferredWidth = CentimetersToPoints(3)
    End With
 
     With .Columns(2)
       .PreferredWidthType = wdPreferredWidthPoints
     .PreferredWidth = CentimetersToPoints(13)
    End With
Visually, it gives the impression the first 'End With' related to 'With wdTbl', which it doesn't and that 'With .Columns(2)' ... 'End With' is outside the 'With wdTbl' ... 'End With' structure. Consider also Greg's comments about your code in this thread:
https://www.msofficeforums.com/word-...ated-word.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #19  
Old 03-30-2016, 04:45 PM
rpb925 rpb925 is offline Adding tables to Created word document whilst other word document open Help Windows 7 64bit Adding tables to Created word document whilst other word document open Help Office 2010 64bit
Novice
Adding tables to Created word document whilst other word document open Help
 
Join Date: Mar 2016
Location: Sydney
Posts: 17
rpb925 is on a distinguished road
Default

Paul I took on your the verbose approach and used
Code:
'1cm=28points
            With .Columns(1)
            .Width = 84
            End With
             
            With .Columns(2)
            .Width = 364
            End With
and worked a treat. I think the tables are sorted now.
Reply With Quote
Reply

Tags
add, tables, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding furigana to a Word document rjribbit Word 0 12-03-2015 09:33 AM
Adding tables to Created word document whilst other word document open Help Inexperienced user having dificulty adding text to document I created. Fixed text moves around. Athalwolf Word 2 02-08-2015 09:08 AM
Adding tables to Created word document whilst other word document open Help Error message opening a document in Word "Word cannot open this file because it is larger than 512 M poonamshedge Word 2 09-11-2014 06:11 AM
Adding tables to Created word document whilst other word document open Help Adding and Moving parts of a document in Word PauledInAction Word 4 07-13-2012 02:38 PM
Adding bullets in a protected Word document Cindylu3 Word 0 10-03-2008 03:16 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft