Hi all!
Following is an excel macro code which is recorded in excel, placed in code stage.
and there are compiler error when we check code.
I'm very new to VB code so if anyone could get me clue to get closer to the resolution, I would really appreciate it.
(Is there possibility that PageSetup related dll is neccesary?)
Inputs
![29610.png 29610.png](/t5/image/serverpage/image-id/29735i73DA120CE7F83DE4/image-size/large?v=v2&px=999)
Outputs
![29611.png 29611.png](/t5/image/serverpage/image-id/29736i9C89D1B9DB104A71/image-size/large?v=v2&px=999)
Code
--------------
Dim excel as Object
Dim ws as Object = GetWorksheet(handle, workbookname, worksheetname)
Dim wb as Object = GetWorkbook(handle, workbookname)
Dim xlPrintSheetEnd = 1
Dim xlPaperA4 = 9
ws.Activate()
wb.Activate()
excel = wb.Application
excel.PrintCommunication = False
With ws.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
excel.PrintCommunication = True
ws.PageSetup.PrintArea = ""
excel.PrintCommunication = False
With ws.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = excel.InchesToPoints(0.7)
.RightMargin = excel.InchesToPoints(0.7)
.TopMargin = excel.InchesToPoints(0.75)
.BottomMargin = excel.InchesToPoints(0.75)
.HeaderMargin = excel.InchesToPoints(0.3)
.FooterMargin = excel.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintSheetEnd
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 2
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
-
Validation![29612.png 29612.png](/t5/image/serverpage/image-id/29740iB601082A58C2E3CC/image-size/large?v=v2&px=999)
Warm Regards
Yuna
------------------------------
Yuna Lee
Solution Consultant
Blue Prism Korea
------------------------------