Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
HELP WITH WORK/EXCEL MACRO
I have a macro where I paste cells into a word document, but it does not
center on the page. I want the table to center with a macro. Can someone help? Here is my code: Private Sub CommandButton1_Click() Worksheets("Report").Unprotect Dim rng As Range, c As Range Set rng = Selection For Each c In rng If c.Interior.ColorIndex = 15 Then c.Interior.ColorIndex = 2 End If Next c For Each c In rng If c.Font.ColorIndex = 5 Then c.Font.ColorIndex = 2 End If Next c Range("A1:J9769").Select Selection.Copy Dim WDApp As Object Dim WDDoc As Object Dim myDocName As String myDocName = "Survey Report.doc" 'Open Word and add a new document Set WDApp = CreateObject("Word.Application") WDApp.Visible = True WDApp.Activate Set WDDoc = WDApp.Documents.Add WDDoc.Range.Paste WDDoc.Selection.tables(1).Rows.Alignment = .wdAlignRowCenter Worksheets("Report").Protect ws_exit: Application.EnableEvents = True End Sub Thank you!!!! Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to update a column in a work based on another work sheet | New Users to Excel | |||
Using a macro to work from Excel to Outlook | Excel Programming | |||
Excel problem - why won't my macro work? | Excel Programming | |||
Macro doesn't work in Excel 97 | Excel Programming | |||
Macro: Excel 2000 does not work, XP does... | Excel Programming |