change page orientation in xlsx to landscape

jloyzagaatsw

New Member
Joined
Nov 27, 2016
Messages
26
I have this code that I found on the internet that I'd like to add to my existing code - this is the code - can you help me out? - Joe
Code:
[/FONT][/COLOR][COLOR=#660066]Dim[/COLOR][COLOR=#000000] ie [/COLOR][COLOR=#660066]As[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Object[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Dim[/COLOR][COLOR=#000000] wbk [/COLOR][COLOR=#660066]As[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Workbook[/COLOR][COLOR=#000000]   [/COLOR][COLOR=#660066]Set[/COLOR][COLOR=#000000] ie [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]CreateObject[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"[COLOR=#009900 !important][U]excel[/U][/COLOR].[COLOR=#009900 !important][U]Application[/U][/COLOR]"[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]'ie.Visible = displayResults '[/COLOR][COLOR=#000088]not[/COLOR][COLOR=#000000] VBA so I don[/COLOR][COLOR=#008800]'t know what it does   Set wbk = ie.Workbooks.Open("test.xls")     '[/COLOR][COLOR=#660066]This[/COLOR][COLOR=#000000] changes the margins [/COLOR][COLOR=#000088]and[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088][COLOR=#009900 !important][U]print[/U][/COLOR][/COLOR][COLOR=#000000] area     [/COLOR][COLOR=#660066]With[/COLOR][COLOR=#000000] ie[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ActiveSheet[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]PageSetup[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Orientation[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] xlLandscape           [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]LeftMargin[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Application[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]InchesToPoints[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]0.75[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]RightMargin[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Application[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]InchesToPoints[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]0.75[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]TopMargin[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Application[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]InchesToPoints[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]BottomMargin[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Application[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]InchesToPoints[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]HeaderMargin[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Application[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]InchesToPoints[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]0.5[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]FooterMargin[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Application[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]InchesToPoints[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]0.5[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]          [/COLOR][COLOR=#660066]End[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]With[/COLOR][COLOR=#000000][FONT=Verdana]
And I'd like to put it in here but I keep getting an error requiring an object
Code:
[/FONT][/COLOR][COLOR=#660066]Dim[/COLOR][COLOR=#000000] objSheet                            [/COLOR][COLOR=#008800]'[COLOR=#009900 !important][U]Disable[/U][/COLOR] [COLOR=#009900 !important][U]alerts[/U][/COLOR]         oEngine.DisplayAlerts = False                           '[/COLOR][COLOR=#660066]Add[/COLOR][COLOR=#000000] a workbook to the [/COLOR][COLOR=#660066]Excel[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]App[/COLOR][COLOR=#000000]                oEngine[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Workbooks[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Add[/COLOR][COLOR=#000000]           [/COLOR][COLOR=#660066]Set[/COLOR][COLOR=#000000] objSheet [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] oEngine[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]           oEngine[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Select[/COLOR][COLOR=#000000]           [/COLOR][COLOR=#660066]With[/COLOR][COLOR=#000000] objSheet           [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Name[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]"Front Page"[/COLOR][COLOR=#000000]            [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Shapes[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]AddPicture[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]"C:\ReportGeneration\Capgemini_logo_high_res.jpg"[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]True[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]True[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]100[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]100[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]-[/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]-[/COLOR][COLOR=#006666]1[/COLOR][COLOR=#000000]      [/COLOR][COLOR=#660066]End[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]With[/COLOR][COLOR=#000000]        oEngine[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ActiveWindow[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]FreezePanes[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]True[/COLOR][COLOR=#000000]         [/COLOR][COLOR=#660066]Set[/COLOR][COLOR=#000000] objSheet [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] oEngine[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600])[/COLOR][COLOR=#000000]           oEngine[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Select[/COLOR][COLOR=#000000]           [/COLOR][COLOR=#660066]With[/COLOR][COLOR=#000000] objSheet                   [/COLOR][COLOR=#008800]'Rename the first sheet to "Test_Summery"                       .Name = "Test_Summary"                  '[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]DisplayGridlines[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]False[/COLOR][COLOR=#000000]                      [/COLOR][COLOR=#008800]'Set the Heading                        .Range("B1").Value = "Test Results"                     .Range("C1").Value = "Test Stats"                                       '[/COLOR][COLOR=#660066]Set[/COLOR][COLOR=#000000] color [/COLOR][COLOR=#000088]and[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Fonts[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]for[/COLOR][COLOR=#000000] the [/COLOR][COLOR=#660066]Header[/COLOR][COLOR=#000000]                     [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B1:C1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Interior[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ColorIndex[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]53[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B1:C1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Font[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ColorIndex[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]19[/COLOR][COLOR=#000000]                    [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B1:C1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Font[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Bold[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]True[/COLOR][COLOR=#000000]                                [/COLOR][COLOR=#008800]'Set the [COLOR=#009900 !important][U]Date and time[/U][/COLOR] of Execution                     .Range("B3").Value = "Test Date: "                      .Range("B4").Value = "Test Start Time: "                        .Range("B5").Value = "Test End Time: "                  .Range("[COLOR=#009900 !important][U]B6[/U][/COLOR]").Value = "Test Duration: "                          .Range("C3").Value = Date                       .Range("C4").Value = Time                       .Range("C5").Value = Time                       .Range("C6").Value = "=R[-1]C-R[-2]C"                   .Range("C6").NumberFormat = "[h]:mm:ss;@"                                               '[/COLOR][COLOR=#660066]Set[/COLOR][COLOR=#000000] the [/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]for[/COLOR][COLOR=#000000] the [/COLOR][COLOR=#660066]Date[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]&[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Time[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Cells[/COLOR][COLOR=#000000]                      [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B3:C8"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]1[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B3:C8"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]1[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B3:C8"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]3[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]1[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B3:C8"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]4[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]1[/COLOR][COLOR=#000000]                                                [/COLOR][COLOR=#008800]'[COLOR=#009900 !important][U]Format[/U][/COLOR] the Date and Time Cells                 .Range("B3:C8").Interior.ColorIndex = 40                        .Range("B3:C8").Font.ColorIndex = 12                    .Range("B3:A8").Font.Bold = True                                '[/COLOR][COLOR=#660066]Track[/COLOR][COLOR=#000000] the [/COLOR][COLOR=#660066]Row[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Count[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]and[/COLOR][COLOR=#000000] insrtuct the viewer [/COLOR][COLOR=#000088]not[/COLOR][COLOR=#000000] to disturb [/COLOR][COLOR=#000088]this[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"C7"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]AddComment[/COLOR][COLOR=#000000]                 [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"C7"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Comment[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Visible[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]False[/COLOR][COLOR=#000000]                    [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"C7"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Comment[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Text[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]"This is a very Important field for the script."[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]&[/COLOR][COLOR=#000000] vbCrLf [/COLOR][COLOR=#666600]&[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]"Please Do not [COLOR=#009900 !important][U]Edit[/U][/COLOR] or Delete."[/COLOR][COLOR=#000000]                   [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"C7"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]"0"[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B7"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#008800]"No Of Testcases:"[/COLOR][COLOR=#000000]                         [/COLOR][COLOR=#008800]'Track the Testcase Count Count and insrtuct the viewer not to disturb this                     .Range("C8").AddComment                 .Range("C8").Comment.Visible = False                    .Range("C8").Comment.Text "This is a very Important field for the script." & vbCrLf & "Please Do not Edit or Delete."                   .Range("C8").Value = "0"                        .Range("B8").Value = "Total No Of Test Steps:"                                          .Range("B10").Value = "TestCase Name"                   .Range("C10").Value = "Status"                  .Range("D10").Value = "No Of Steps"                     .Range("E10").Value = "*Click the TestCase Name to see detail result."                                          '[/COLOR][COLOR=#660066]Format[/COLOR][COLOR=#000000] the [/COLOR][COLOR=#660066]Heading[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]for[/COLOR][COLOR=#000000] the [/COLOR][COLOR=#660066]Result[/COLOR][COLOR=#000000] [/COLOR][COLOR=#660066]Summery[/COLOR][COLOR=#000000]                      [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B10:D10"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Interior[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ColorIndex[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]53[/COLOR][COLOR=#000000]                      [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B10:D10"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Font[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]ColorIndex[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#006666]19[/COLOR][COLOR=#000000]                  [/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B10:D10"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Font[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Bold[/COLOR][COLOR=#000000] [/COLOR][COLOR=#666600]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000088]True[/COLOR][COLOR=#000000]                              [/COLOR][COLOR=#008800]'Set the Borders for the Result Summery                 .Range("B10:D10").Borders(1).LineStyle = 1                      .Range("B10:D10").Borders(2).LineStyle = 1                      .Range("B10:D10").Borders(3).LineStyle = 1                      .Range("B10:D10").Borders(4).LineStyle = 1[/COLOR]
[COLOR=#008800] '[/COLOR][COLOR=#660066]Set[/COLOR] [COLOR=#660066]Column[/COLOR] width                      [COLOR=#666600].[/COLOR][COLOR=#660066]Columns[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B:D"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Select[/COLOR]                  [COLOR=#008800]'.Columns("C:D").Autofit                        .Columns("B:B").ColumnWidth = 80
 .Columns("B:C").WrapText = False                       .Range("B11").Select            End With                '[/COLOR][COLOR=#660066]Freez[/COLOR] pane             oEngine[COLOR=#666600].[/COLOR][COLOR=#660066]ActiveWindow[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]FreezePanes[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#000088]True[/COLOR]                 [COLOR=#008800]'Get the object of the first sheet in the workbook              Set objSheet = oEngine.Sheets.Item(3)           '[/COLOR]oEngine[COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Select[/COLOR]          [COLOR=#660066]With[/COLOR] objSheet                                           [COLOR=#008800]'Rename the first sheet to "Test_Results"                       .Name = "Test_Results"                  '[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]DisplayGridlines[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#000088]False[/COLOR]                      [COLOR=#008800]'Set the [COLOR=#009900 !important][U]Column[/U][/COLOR] widths                  .Columns("A:A").ColumnWidth = 35                        .Columns("B:B").ColumnWidth = 8                 .Columns("C:D").ColumnWidth = 35                        .Columns("E:E").ColumnWidth = 35                        .Columns("F:F").ColumnWidth = 25                        .Columns("G:G").ColumnWidth = 65                        .Columns("A:E").HorizontalAlignment = -4131                     .Columns("A:E").WrapText = True                                                         '[/COLOR][COLOR=#660066]Set[/COLOR] the [COLOR=#660066]Heading[/COLOR] [COLOR=#000088]for[/COLOR] the [COLOR=#660066]Result[/COLOR] [COLOR=#660066]Columns[/COLOR]                 [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"A1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#008800]"TEST CASE / OBJECTIVE"[/COLOR]                    [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"B1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#008800]"STATUS"[/COLOR]                   [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"C1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#008800]"EXPECTED RESULT"[/COLOR]                  [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"D1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#008800]"ACTUAL RESULT"[/COLOR]                    [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"E1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Value[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#008800]"ERROR MESSAGE"[/COLOR]                                            [COLOR=#008800]'Format the Heading for the Result Columns                      .Range("A1:E1").Interior.ColorIndex = 53                        .Range("A1:E1").Font.ColorIndex = 19                    .Range("A1:E1").Font.Bold = True                                '[/COLOR][COLOR=#660066]Set[/COLOR] the [COLOR=#660066]Borders[/COLOR] [COLOR=#000088]for[/COLOR] the [COLOR=#660066]Result[/COLOR] [COLOR=#660066]Header[/COLOR]                  [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"A1:E1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]1[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#006666]1[/COLOR]                        [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"A1:E1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#006666]1[/COLOR]                        [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"A1:E1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]3[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#006666]1[/COLOR]                        [COLOR=#666600].[/COLOR][COLOR=#660066]Range[/COLOR][COLOR=#666600]([/COLOR][COLOR=#008800]"A1:E1"[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Borders[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]4[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]LineStyle[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#006666]1[/COLOR][COLOR=#008800]'                                       .Range("[COLOR=#009900 !important][U]A2[/U][/COLOR]").Select             End With                '[/COLOR][COLOR=#660066]Freez[/COLOR] pane             oEngine[COLOR=#666600].[/COLOR][COLOR=#660066]ActiveWindow[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]FreezePanes[/COLOR] [COLOR=#666600]=[/COLOR] [COLOR=#000088]True[/COLOR]                 [COLOR=#008800]'Save the Workbook at the specified Path with the Specified Name                oEngine.ActiveWorkbook.saveas FilePath          msgbox oEngine.Sheets.Item(1).Name              '[/COLOR][COLOR=#660066]Set[/COLOR] objSheet [COLOR=#666600]=[/COLOR] oEngine[COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600])[/COLOR]          msgbox oEngine[COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]2[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Name[/COLOR]              msgbox oEngine[COLOR=#666600].[/COLOR][COLOR=#660066]Sheets[/COLOR][COLOR=#666600].[/COLOR][COLOR=#660066]Item[/COLOR][COLOR=#666600]([/COLOR][COLOR=#006666]3[/COLOR][COLOR=#666600]).[/COLOR][COLOR=#660066]Name[/COLOR]              [COLOR=#008800]'Relese the Object              Set objSheet = Nothing
[/COLOR][COLOR=#008800] End Function[/COLOR][COLOR=#000000][FONT=Verdana]
 

Forum statistics

Threads
1,082,589
Messages
5,366,494
Members
400,895
Latest member
Anthonemr

Some videos you may like

This Week's Hot Topics

Top