Buttons to save as .pdf and as .xlsx

Hello everyone,
I have used the following code to save as pdf but what I would like to do something similar not exactly that (found the code in here Macro
to create Excel data to PDF file. )
Sub SavePDF()
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:="C:\PDFs\No." & _
        ActiveSheet.Range("AY8").Value & ".pdf", _
Worksheets("Sheet1").Range("A1:I50").ExportAsFixedFormat _
        OpenAfterPublish:=False
End Sub
- What I want is saving the file automatically by getting the name from three cells. For example K10, A10, K12 and if the name already exists in that folder than automatically put an underscore on the end or something similar.
- Furthermore I would like to save data only from Sheet 1 (My Sheet name is: Testing) and page 1 and not the whole sheet. Is that possible?
- Moreover, make the file as read only
- To end, as title says, I would like to add another button to save the sheet that I am working at as it is and not the whole workbook using the same customization as for the pdf. 
Thank you in advance.

Hi Ioannis,
Base on your code, it is used to export the current sheet to pdf.
To save specify sheet to a different file, we could use
Worksheet.SaveAs method.
To check whether file is exist, we could use Dir method.
If Dir([file path]) <> "" Then
MsgBox "File exists."
Else
MsgBox "File doesn't exist."
End If
To make the file as read only, we could use
worksheet.Protect to lock the worksheet. If someone want to change the data, he needs the password. The
Workbook.Protect method can protect whole workbook.
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Share, Save as PDF and Find in Page are grayed

    Sahre, Save as PDF and Find in Page are grayed in settings. I uninstalled and deleted Firefox 34.0.1 from f-droid.org. Redownloaded and reinstalled Firefox. I am using a Motorola Droid 3 with Android 2.3.4.

    Are you using a custom rom? Please try our nightly build from https://nightly.mozilla.org select the Android ARMv7 Android 2.3 button.

  • Save as PDF and Save PDF as PostScript options in the Printer dialog are not supported.

    I downloaded Indesign CS3 trial and liked everything about it until I attempted to print to postscript and got that message. Nothing I have tried has helped. I have seen in various forums that others are having the same problem, but haven't found any solution offered. I am running Tiger 10.4.10 on a new Intel Imac with 3G ram. This is a procedure I use very often in my workflow, and have never had this problem with CS2 on my PC or other Macs. Is there a solution? I downloaded the .1 update and installed that and it didn't change anything.

    PLEASE SOMEONE HELP ME.
    Its the first time Im using print booklet option to save my file. I have the same problem when trying to save as pdf and get the
    "The Save as PDF and Save PDF as PostScript options in the Printer dialog are not supported."
    I'm trying to save a .pdf of a booklet of a facing pages document of A4 size each facing page for a whole size A3, then hope to let the pages be correctly arranged by inDesing, then print and staple.
    Meaning pages will be like this - Page #60 left side [of the A3] - page #1 right side [of the A3] , page # 2 right side[of the A3] - page #59 left side[of the A3] etc...
    I CANT DO IT. I tried to follow Melvin Thompson , but when I choose save .ps and open it in preview all I see is independent a4 pages and just the left ones , .. How can I save my file as .pdf ready to be printed in a3 ?
    I really appreciate any help.

  • Certain pop up windows are not apperaing on my screen.  Save as PDF and Doc preferences never appear

    Certain pop up windows are not apperaing on my screen.  Save as PDF and Doc preferences never appear, and lock me out until I press return.  So they are active, I just can't see them.  Any ideas?

    They are obviously off the screen somewhere. Did you have a dual monitor set up at one time? You can try increasing the resolution of your screen to see if you can get a part to show or maybe just resrt the preferences (Cmd(Ctrl)+Opt(Alt)+Shift as you restart AI) to reset the defaults.

  • I'm in Final Draft (screenwriting prgram) and hit Save as PDF and a window opens stating that the printer name is invalid - what am I doing wrong?

    I'm in Final Draft (screenwriting prgram) and hit Save as PDF and a window opens stating that the printer name is invalid - what am I doing wrong?

    Final Draft, Inc. - Search: printer name invalid

  • Why does my guides dissapear after i save my pdf and open it again?

    Why does my guides dissapear after i save my pdf and open it again?
    Basically i use guides a lot when creating or editing PDFs, however when i am done editing and i save my work and close it. The next time i open up the pdf to edit, my initial guides when i created the Pdf is missing. This is really annoying. does anyone know how to fix this problem?

    Yes go to preferences, and then click on security and privacy.

  • FrameMaker 10 Save as PDF and landscape pages

    Using FrameMaker 10 on Windows XP Professional SP3 32 bit system - When I use the Save as PDF function on a book containing both portrait and landscape pages, the landscape pages are clipped to portrait mode. If I print to Adobe PDF, the page orientation is correct in the PDF, however, no bookmarks are generated. If I check the Convert CMYK colorsto RGB setting in the PDF Setup for Selected Files dialog box, then the page orientation in the PDF is correct, and the bookmarks are generated as they were in FrameMaker 8.
    Is there a method to this madness?

    I have Acrobat 8 Pro. The explanation of the RGB mode with XP makes sense. I did not know that. Makes me wonder how Frame 8 was producing all the nice PDFs we have used for the last couple of years.
    I tried that setting because I saw others were having issues with that and wondered if there was a relationship between the two. Just a guess.
    Printing to a file and distilling it does not produce a PDF at all.
    Thanks for your help.

  • Save as pdf and excel file

    Hi All,
    Can anyone tell me how to save data available in a node(model or value) as pdf and excel files?
    Thanks in advance.....
    Bhushan Reddy.

    Bhushan,
    check these links for saving as excel
    Excel Export - Funky Column Headers
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0
    Handling FileUpload and FileDownload in NetWeaver Developer Studio(NWDS) 2004S
    New Web Dynpro Java Tutorials - Uploading and Downloading Files in SAP NetWeaver 7.0
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
    Thanks
    Bala Duvvuri

  • Is it possible for me to script Illustrator to save as PDF and attach to email ?

    Hi,
    I am after a script to save my current working file as PDF (with some settings) and then bring up a blank outlook email with that file attached ?
    I do a lot of artwork and have to get it approved, I am getting bored of manually saving to PDF then going to find the file and then clicking send to > mail recipient etc etc
    You know the drill guys.
    So would it be possible for me to just run a script that does all that for me ready to insert the persons name or even add the persons name within the script ?
    thanks
    Lee

    Well, as the kids' paper-crafts book I used to try to put together which frustrated the hell out of me, mockingly read on the bottom of the instructions: "ТЕРПЕНИЕ И ТРУД ВСЕ ПЕРЕТРУТ"
    That is, patience and perseverance will overcome all. 
    To use the below, you've gotta get Autohotkey_L, I believe, and it's not that hard to use.. but it takes some time to learn the various things if you want to write your own ones like this:
    {{YOUR_OWN_HOTKEY_HERE}}::
      MyTempFile = C:\Users\{{YOUR_USER_NAME}}\last_proof_sent.txt
      Run {{YOUR_JSX_SCRIPT}}.jsx                                                  ;Save the PDF proof - the script needs to write a temp text file in a place somewhere, which writes the full name of your saved PDF!
                                                                                                              ; I called my temp text file "last_proof_sent.txt"
      CurrentDateTime := A_Now                                                        ;get current time
      sleep, 500
      FileGetTime, FileTime, %MyTempFile%                                              ;get mod date of this temp file
      TimeCounter = 0                                                                                ;initialize time counter for waiting for PDF to save
      While(CurrentDateTime > FileTime and TimeCounter < 1000)                    ;waiting period to see if temp text file has updated since start of this script
      sleep, 20
      TimeCounter++
      FileGetTime, FileTime, %MyTempFile%                                                      ; each time get the modification date of the temp text file
      If(CurrentDateTime < FileTime){
      FileRead, MyPDFFileName, %MyTempFile%                                                  ;read the contents of temp file for location of PDF file path (It was written there by your JSX script, hopefully)
      If Not ErrorLevel{
      m := ComObjActive("Outlook.Application").CreateItem(0)
      m.Subject := "Greetings to all"                                                                      ; <---- Subject -----
      m.To := "address here"                                                                                    ; <---- Recipient -----
      m.HTMLBody := "email body"                                                                          ; <---- Email message body -----
      m.Display
      m.attachments.add(MyPDFFileName)                                                             ;  This is the attachments!
      } else {
      MsgBox, Error Reading the temporary file %MyTempFile%
      } else {
      MsgBox, "Sorry, action timed-out."
    return
    *** I have tested this on one file where I had a test folder on my desktop.  The ExtendScript likes to put the file path like "~Desktop/", but I used myFile.fsName to get the full "C:/Users/Me..." name in case it was gonna be confusing to AHK.

  • Stupid PDF Question:  What's the difference between "Save As PDF" and Printing to a PDF "printer"?

    Is there a quality difference? 
    The "Save As" seems to run Distiller, but if I select "Print Document" and select "Adobe PDF" as the printer, it also seems to work OK, although I sometimes get a "Times" font not available, will be replaced by "Times New Roman", even though I can't find any reference to "times" in my book.
    Is there an advantage to running Distiller?
    Thanks!
    John
    www.controlgeek.net

    > Is there a quality difference?
    I'd expect them (as well as print-to-Ps & Distill) to be the same for the same settings.
    We print to Ps & Distill, for several reasons, not all of which may apply to you:
    More control. Distilling provides menus for everything Adobe lets you control in PDF gen. Print/SaveAs may not (and don't in our environment).
    Faster printing (Frame doesn't have to wait for the tps to pdf gen). You can get back to work while a long job renders.
    Unequal versions/different platforms. We author on FM8/Unix and Distill on Acro9/PC.
    > ... although I sometimes get a "Times" font not available, will be replaced by "Times New Roman", even though I can't find any reference to "times" in my book.
    Save the component files to MIF and examine with a plaintext editor. If not found, the font invocation is probably coming in with a text inset, or a graphic of type DWG, DXF, EPS, PDF or possibly SVG.

  • Save as PDF and fonts

    When I choose "save as pdf" in the print dialogue box, are the fonts used in the document automatically embedded in the PDF?
    I would like to email this PDF to a Windows user, but want to ensure they see the same that I see on my Mac, wit all fonts and layout correctly displayed.
    Thanks.
    Simon

    That is correct. The windows user will see the pdf the way you saved that document as a pdf, with the fonts and layout as you had saved it in the document.
    hope this helps

  • Save as PDF and AI file at the same time?

    Hey everyone,
    I was wondering if it's possible to save an AI file as both an AI file & PDF file at the same time??
    Where i work, we always need to save an AI file and a PDF file. So is there a way I can set up my Illustrator so everytime i save something, it'll  save the AI file and automatically create the PDF too? ..
    Or is there no way around .... Save as: Illustrator file.  /   Save as: PDF file in two separate actions?...
    Any help would be greatly appreciated.
    Thanks!
    Jay

    I was wondering if it's possible to save an AI file as both an AI file & PDF file at the same time??
    Where i work, we always need to save an AI file and a PDF file. So is there a way I can set up my Illustrator so everytime i save something, it'll  save the AI file and automatically create the PDF too? .
    No, it is not possible in the base product.
    (I guess it is probably doable with scripting, I'll defer to others on that.)
    But can you stop and tell us why you want to do this?
    AI files with "Preserve PDF Compatibility" and PDF files with "Preserve Illustrator Editing Capabilities" are functionally equivalent. Both of which are the default. In both cases, the file contains a PDF portion that is visible to PDF viewers, and an Illustrator private data section that is used by Illustrator. Two entirely complete versions of the information that can stand on their own appear in both file types.
    While I realize the requirement may be beyond your control, it would still be good to understand it's origin.

  • Framemaker 12, Save as PDF and Print PDF Not working...

    We are using Framemaker 12 version 12.0.3.424, it tells me it is the latest patch level, and the issue we are having is that it won't either save as or print to PDF, both options are failing, they start up and then go to a certain point and come up as "not responding" and then just stops. I have managed to get a postscript file on two occasions that got 141 pages out of 1400+. I have gone through a bunch of the threads here and made sure that I have changed Adobe PDF printer to the default and deselected the box about using the specific fonts, still nothing. We are also using Adobe Acrobat XI Standard, and that is now up to the latest patch level as well. I am running out of things to try in order to get this full book put together and ready for delivery. If anyone has any additional things to try that would be great. One thing I feel might be an issue is that some of the files seem to be using a different font, "Times" vs. "Times New Roman", Frame automatically substitutes it, so was wondering if that is the issue.
    Any and all assistance will be great on this.

    > .ps file was running about 57,000kb
    Then you aren't anywhere near a 32-bit file size constraint.
    > We are running 64 bit machines here, though the program I think is the 32 bit version.
    Pretty much all CPUs are 64-bit now. What matters is the OS version, and Win7 and 8 installs are commonly 64-bit these days. FM may not even have specific 32- or 64-bit installs. I've tested FM9 on Win7/64 for file size limits, and it sails past 4GB with no problems.
    > ... stops everytime on one particular page, that has was is an OLE linked .vsd file in it.
    As if the world needed another reason to never ever use OLE for anything anywhere, esp. in Framemaker. Export that object in a stable graphical file format (PDF should work). Import that.

  • Save as PDF and Nothing appears

    I am using these two templatses in Illustrator CS3 to create a tri-fold brochure. Everything has been going pretty good, slow but good. Then I went to see how my brochure would look when I saved it as a PDF. Then when I open the newly created PDF nothing shows up, it is just a blank, white PDF. Not sure what I am doing wrong here.
    After I open a template file I immediately do a save as, and rename the file and work with the it as an EPS file. I then got to a point and saved it as a pdf, but as I said earlier nothing shows in the PDF.
    The templates I am using are as follows:
    Brochure Inside_Blank.ait
    Brochure Outside_Blank.ait
    Can someone help me out with this?

    Thanks I appreciate your help. Both of your suggestions are spot on. All my layers are under the guide layer. Is there a way to transfer the layers that I have already done into a printable layer?
    Also I will start saving my work as an AI rather than an EPS. Is there a time when I should use EPS or would you just stick w/ saving as AI?

  • 'Save as pdf' and nothing happens?!?

    Hi,
    I encountered a problem with saving PDF from Illustrator files. I open/create an Illustrator *.ai file and when I choose 'Save as' it seems nothing happens.
    However when I press 'Enter' a PDF with the default options is saved. Now I would like to change these options, but how without seeing the dialog? It happens with all my files (several/one artboards, different color  modes,etc...) I have tried everything to get my dialog back but no chance!
    This is what I have tried:Rebooting, ReInstalling Illustrator, ReInstalling Destiller, ReInstalling the whole Design Suite
    System: Win7, CS4.
    Any help is appreciated!

    Mooslahti,
    The dialog box is outside the screen. You may increase the screen resolution, drag it to the centre, and reduce the resolution again. There is another way I am trying to remember.
    Ah, there it was: Harron normally says it: Move (or hit M) and use your arrow  keys to move the  dialog box back on  screen.

Maybe you are looking for

  • MRSS issue in work order.

    Hi all, i have need your help to solve the below mentioned issue. Right now i am doing a sap upgradation. in the part of testing i executed the iw31 tcode. afte entering all the data the i just saved it. while saving the order the warning came like"

  • HTML in Java best practices?

    I have developed an application that performs some data analysis. When the data is analyzed I create a result file in XML using JDOM. This information is then transformed into HTML using XSLT (xalan). The resulting HTML is launched in the standard br

  • HT201209 I HAVE BOTH A GIFT CARD AND A CREDIT CARD ON ITUNES.  HOW DOES IT KNOW WHAT TO CHARGE

    I just want to know how itunes knows whether to charge my credit card or my gift card

  • DP91-Debit memo request -selling price

    Dear Friends, the client requirement is to bill the his customer based on the equipment and manpower utilized Now i have created a contract - has assigned the DIP profile in item category and the WBS element is attached in contract item level based o

  • Particular crash

    First, apologise my poor language: I am french. Well, i bought a theme template called videohive circle reveal to make a commercial ad. My problem is taht when i want to render it or have a preview it always crash at the same point with the tradition