+ Reply to Thread
Results 1 to 4 of 4

Print to PDF and Resize Row Height by Len Text

Hybrid View

  1. #1
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Thumbs up Print to PDF and Resize Row Height by Len Text

    how i can do looping print to pdf
    and automatic row height (if len text is short then wrap row height will be short else row height will be autofit with text) by criteria in K14
    this is my makro
    -------------------------------------------------------------------------------------
    Public Const Path = "C:\Users\test\"
    Sub PrintTOPDF()
    Sheets("Data").Activate
    With Application
    .ScreenUpdating = 0
    End With
    For r = 1 To 5
    Range("K14").Value = r
    'how i can autofit Row in range("C14:i14") by lookup value in k14
    'how i can do exportPdf with select folder (folder picker)
    'how i can do after item1 ,item2,item3,item4 and item5 print to pdf then merge to one file in pdf can do it ?
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    Path & "Item" & r & ".pdf", Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False
    Next
    With Application
    .ScreenUpdating = 1
    End With
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: Print to PDF and Resize Row Height by Len Text

    i has find ok thankyou solved

  3. #3
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Print to PDF and Resize Row Height by Len Text

    I felt “.WrapText = True” is unstable, suggest “.justify”.

    Sub ZZ()
    Application.ScreenUpdating = 0
    Application.DisplayAlerts = 0
    Dim arr As Variant, MyW As Single, OW As Single, r%
    With Sheets("data")
        arr = .[c1].CurrentRegion
        .[c14].WrapText = False
        .[c14].MergeCells = False
        OW = .[c14].ColumnWidth
    For i = 3 To 9
        MyW = MyW + Cells(14, i).ColumnWidth
    Next
    .[c14].ColumnWidth = MyW
        For i = 2 To UBound(arr)
            .Range("c14:c" & .[c65536].End(3).Row) = ""
            .[c14] = arr(i, 1)
            .[c14].Justify
            r = r + 1
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            Path & "Item" & r & ".pdf", Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
            False
        Next
        .[c14].ColumnWidth = OW
    End With
    Application.ScreenUpdating = 1
    Application.DisplayAlerts = 1
    End Sub

  4. #4
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: Print to PDF and Resize Row Height by Len Text

    ikboy i mean c14 = vlookup(k14;a2:c6;2;0)
    and k14 is number from a2 to a6
    if k14 = a2 then
    text in c14 is autofit row height
    if k14 = a3 then
    text in c14 is autofit row height
    until A6
    for this step
    ------------------------
    for i = 1 to 6
    range("K14").value = i
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    Path & "Item" & r & ".pdf", Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False
    ' i want after k14 looping by i then printtoPDF and autofit Row height in c14
    next

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] copy table row.height resize row
    By daboho in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-02-2016, 02:21 PM
  2. Replies: 1
    Last Post: 09-25-2015, 11:49 AM
  3. Automatically Resize Row Height for Text Wrap
    By driffert in forum Excel General
    Replies: 0
    Last Post: 02-25-2009, 10:28 AM
  4. Print Dialog seems to resize a text box - ?
    By RSimmons in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2009, 04:10 PM
  5. Row height representations in print/print preview
    By Russell@Tikit in forum Excel General
    Replies: 1
    Last Post: 08-01-2006, 11:20 AM
  6. [SOLVED] What is the trick to make rows resize height automatically?
    By Gumby in forum Excel General
    Replies: 3
    Last Post: 07-13-2005, 03:05 PM
  7. resize row and colomn height
    By Tom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-11-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1