+ Reply to Thread
Results 1 to 2 of 2

Question about create a macro and export as PDF

  1. #1
    Registered User
    Join Date
    12-04-2016
    Location
    tech
    MS-Off Ver
    2016
    Posts
    21

    Question about create a macro and export as PDF

    Hello everybody.
    I'm having a problem here which I searched in forums and I tried to fix it based on what I learned yet no success. I need solution urgent so I might seek an answer in other forums as well such as ExcelGuru and MrExcel ( Cross post policy)

    I wanted to create a macro selects some part of my worksheet and saves it in to the defined directory with the file name in A1.
    A1 had the formula as the file name display. I thought it was the problem so I moved the formula to A2, added Copy-Paste Values action to the macro (copy to A1 again) But still the same problem. It gives me an error saying File Not saved. When I click DEBUG, I see whole code block is colored yellow in VBA editor.

    Here below is the code

    I would appreciate if anyone could point out the mistake....


    Sub PP()
    '
    ' PP Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+P
    '
    Range("A2").Select
    Selection.Copy
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A1:U86").Select
    Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\Users\Murat Erguden\Dropbox\PLANET\5STAR CHA\PAYROLL\2017\ & Range("A1").Value ".pdf" _
    , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    :=False, OpenAfterPublish:=True
    Application.WindowState = xlNormal
    End Sub

    Qc: internet việt nam là địa điểm lư tưởng để đăng kư internet fpt hà tĩnhinternet fpt khánh hoàinternet fpt kon tum cho quư khách.
    Last edited by thanhvanchi; 12-15-2016 at 03:32 AM.
    Ch?c c?c bạn vui vẻ.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Question about create a macro and export as PDF

    Please use Code Tags when posting code.

    Your filename should be formed like this.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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. Create graph per row and export to printable format (e.g. jpg/png/pdf) with macro
    By scissor-paper-rock in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2012, 09:46 PM
  2. I would need a macro to export data from base example workbook to export worbook
    By slato8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 11:21 AM
  3. Export question
    By cathuiz1 in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2012, 02:22 AM
  4. Create Chart Macro from Report - Question
    By dontuch_dg in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 07-01-2009, 04:12 AM
  5. Macro to create PDF's question
    By joeyarsenault19 in forum Excel General
    Replies: 1
    Last Post: 07-15-2006, 10:10 AM
  6. [Macro excel] How to create and export a sheet into a *.inp (or *.txt) file
    By MrKermit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2006, 03:30 AM
  7. [SOLVED] Question about creating macro (to export to quickbooks pro)
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2005, 11:40 PM
  8. Export Specifications Question
    By Eliud Ramos in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-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