Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
xlDoc.Sheets(1).PageSetup.Pages.CountThis is the vbscript I wrote:
sub exportXLS() set xlApp = CreateObject("Excel.Application") xlApp.Visible = false set xlDoc = xlApp.Workbooks.Add xlDoc.Sheets(1).activate set obj = ActiveDocument.getsheetobject("CH325") set titel = ActiveDocument.getsheetobject("TX2447") ActiveDocument.GetApplication.WaitForIdle' Set Data obj.CopyTableToClipboard true xlDoc.Sheets(1).cells(4,1).select xlDoc.Sheets(1).paste titel.CopyTextToClipboard xlDoc.Sheets(1).cells(2,1).select xlDoc.Sheets(1).paste 'delete column 9 xlDoc.Sheets(1).Columns(9).clear lastCell = 2 for i = 5 to 6500 if isempty(xlDoc.Sheets(1).cells(i,1)) then lastCell = i exit for end if next ' Set Format with xlDoc.Sheets(1) .cells.mergecells = false .Cells.EntireColumn.AutoFit 'Columnwidth .Columns(1).Columnwidth = 22 'Label .Columns(2).Columnwidth = 50 'Content .Columns(3).Columnwidth = 8.7 'Submittal Date .Columns(4).Columnwidth = 4.3 'Issue .Columns(5).Columnwidth = 7.1 'Package Revision .Columns(6).Columnwidth = 8.7 'Package Date .Columns(7).Columnwidth = 11 'Trade .Columns(8).Columnwidth = 12 'Drawing Type .PageSetup.Orientation = 2 'Landscape .PageSetup.LeftMargin = xlApp.CentimetersToPoints(2.3) .PageSetup.BottomMargin = xlApp.CentimetersToPoints(1.5) .PageSetup.TopMargin = xlApp.CentimetersToPoints(2) .PageSetup.RightMargin = xlApp.CentimetersToPoints(1) .PageSetup.CenterHeaderPicture.FileName .PageSetup.PrintArea = .Range(xlDoc.Sheets(1).cells(1,1),xlDoc.Sheets(1).cells(lastCell,8)).Address .PageSetup.LeftFooter = "Generated on " & Date & " " & Time .PageSetup.RightFooter = xlDoc.Sheets(1).PageSetup.Pages.Count end with With xlDoc.Sheets(1).Cells.Font .Name = "Arial" .Size = 9 End With 'Title rows xlDoc.Sheets(1).Cells(1,1).Font.Size = 18 xlDoc.Sheets(1).Cells(1,1).Font.Color = RGB(112, 112, 112) xlDoc.Sheets(1).Cells(1,1).Font.Bold = True xlDoc.Sheets(1).Cells(2,1).Font.Size = 16 xlDoc.Sheets(1).Cells(2,1).Font.Color = RGB(112, 112, 112) 'Header row with xlDoc.Sheets(1).Range(xlDoc.Sheets(1).Cells(4,1),xlDoc.Sheets(1).Cells(4,8)) .Font.Bold = true .Interior.Color = RGB(172,172,172) .WrapText = true end with xlApp.Visible = trueend subThanks for any help.
You can try this code maybe helpful
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objDoc = objExcel.Documents.Add()
Set objRange = objDoc.Sections(1).Footers(1).Range
Set objTemplate = objDoc.AttachedTemplate
objTemplate.AutoTextEntries("Page X of Y").Insert objRange
Thanks
Talha
Have you tried it?
.PageSetup.RightFooter ="Pag. &P di &N"
Works!
Daniela
This is it:
.LeftHeader = ""
.CenterHeader = PrinCenterHeader.GetContent.String 'Get variable
.RightHeader = ""
.LeftFooter = "Confidential"
.CenterFooter = ""
.RightFooter = "Page &P+1 of &N" ''Pagefooter -page xx of xxx
/Martin
(The pic is in the same path as the qlikview file.).PageSetup.CenterHeaderPicture.FileName = "Picture.jpg"
.PageSetup.LeftHeaderPicture.Filename = "D:\QV_apps\Finance\Data\Logo\Topbg.jpg"
.PageSetup.LeftHeader = "&G"
/Martin