+ Reply to Thread
Results 1 to 3 of 3

print as pdf or save as in multiple record [lookup record]

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-22-2013
    Location
    Pekanbaru, Indonesia
    MS-Off Ver
    Excel 2013 & Google Sheet
    Posts
    1,146

    print as pdf or save as in multiple record [lookup record]

    hi all....

    i have some macro code to print multiple data record at once...this code work properly..
    now, i want to how to print as pdf or save as pdf that at once based typing record. star record form .....to record .......
    Sub PrintPhoto()
    Dim fromRecord, toRecord, answer, i As Integer
    On Error Resume Next
    
    fromRecord = InputBox("From record", "FROM", 1)
        If fromRecord = 0 Or Not IsNumeric(fromRecord) Then Exit Sub
    toRecord = InputBox("To record", "TO", fromRecord)
        If toRecord < fromRecord Or Not IsNumeric(fromRecord) Then Exit Sub
    answer = MsgBox("printing records" & fromRecord & " to " & toRecord, vbOKCancel, "PRINT")
        If answer <> vbOK Then Exit Sub
        
    For i = fromRecord To toRecord
        [AM8] = i
        With ActiveSheet
            .PrintOut
            .FitToPagesWide = 1
            .FitToPagesTall = 1
        End With
    Next
    
    End Sub
    here this my attachment file

    any help, greatly appreciated...
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-22-2013
    Location
    Pekanbaru, Indonesia
    MS-Off Ver
    Excel 2013 & Google Sheet
    Posts
    1,146

    Re: print as pdf or save as in multiple record [lookup record]

    i hope someone would help me

  3. #3
    Forum Contributor
    Join Date
    01-22-2013
    Location
    Pekanbaru, Indonesia
    MS-Off Ver
    Excel 2013 & Google Sheet
    Posts
    1,146

    Re: print as pdf or save as in multiple record [lookup record]

    hi...

    this macro code work/create as pdf file/format...but one by one record..
    how to make work in multiple record e.g. record from 2 to 10, etc....

    Sub PDFActiveSheet()
    'www.contextures.com
    'for Excel 2010 and later
    Dim wsA As Worksheet
    Dim wbA As Workbook
    Dim strTime As String
    Dim strName As String
    Dim strPath As String
    Dim strFile As String
    Dim strPathFile As String
    Dim myFile As Variant
    On Error GoTo errHandler
    
    Set wbA = ActiveWorkbook
    Set wsA = ActiveSheet
    strTime = Format(Now(), "yyyymmdd\_hhmm")
    
    'get active workbook folder, if saved
    strPath = wbA.Path
    If strPath = "" Then
      strPath = Application.DefaultFilePath
    End If
    strPath = strPath & "\"
    
    'replace spaces and periods in sheet name
    strName = Replace(wsA.Name, " ", "")
    strName = Replace(strName, ".", "_")
    
    'create default name for savng file
    strFile = strName & "_" & strTime & ".pdf"
    strPathFile = strPath & strFile
    
    'use can enter name and
    ' select folder for file
    myFile = Application.GetSaveAsFilename _
        (InitialFileName:=strPathFile, _
            FileFilter:="PDF Files (*.pdf), *.pdf", _
            Title:="Select Folder and FileName to save")
    
    'export to PDF if a folder was selected
    If myFile <> "False" Then
        wsA.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:=myFile, _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, _
            OpenAfterPublish:=False
        'confirmation message with file info
        MsgBox "PDF file has been created: " _
          & vbCrLf _
          & myFile
    End If
    
    exitHandler:
        Exit Sub
    errHandler:
        MsgBox "Could not create PDF file"
        Resume exitHandler
    End Sub

+ 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. Print Multiple Record-Data as Pdf File in 2 Sheets
    By Jhon Mustofa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2017, 09:15 PM
  2. [SOLVED] Save record depending on cell values and if record already exists
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2016, 06:14 PM
  3. simple macro to add new record, edit/ search and print record
    By xmoore in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2015, 08:10 PM
  4. Replies: 14
    Last Post: 10-07-2013, 04:04 PM
  5. Replies: 1
    Last Post: 11-16-2012, 09:25 AM
  6. Command Buttons for Viewing Record, Next Record and Previous Record
    By david1987 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-23-2012, 06:30 AM

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