Creating and saving a document (excel) in a folder itself?

Discussion in 'Mac Apps and Mac App Store' started by Atomant669, Dec 3, 2015.

  1. Atomant669 macrumors regular

    Joined:
    Oct 28, 2011
    #1
    Possible to open and create an excel or word document in a folder instead of going the long route of clicking on the Document icon, 'new sheet' and 'save as'?

    Appreciate any help.
     
  2. dangerfish macrumors 6502

    Joined:
    Aug 28, 2007
    #2
    Power users utilize keyboard shortcuts.
    In this case cmd+n followed by shift+cmd+s
     
  3. bernuli macrumors 6502

    Joined:
    Oct 10, 2011
    #3
    I wish that was a feature myself. I use the following workaround though it is a little clunky.

    When saving a new document in Excel, you can drag the folder from the finder and drop it on the save dialog box. I first type the name of the file in the Save As: field, then drag the folder from the path bar of the folder I have open.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      606.9 KB
      Views:
      43
    • 2.png
      2.png
      File size:
      663.1 KB
      Views:
      48
  4. Atomant669 thread starter macrumors regular

    Joined:
    Oct 28, 2011
    #4
    Thanks Bernuli, I think that's what exactly I am doing now.

    I am looking to just create an 'excel' or 'word' document right from the Folder where I want to save it at.

    I guess there's no other 'efficient' way around this huh?
     
  5. bernuli macrumors 6502

    Joined:
    Oct 10, 2011
    #5

    Don't think so, not that I know of anyway.

    I still find myself right clicking in the folder I am in, hoping to see "create new Excel file here" but I never see it.
     
  6. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #6
    That's what I use, I prefer the keyboard shortcuts where ever possible, and in some cases I use macros to automate certain tasks and assign those to a keyboard shortcut as well.
     
  7. bernuli macrumors 6502

    Joined:
    Oct 10, 2011
    #7
    Actually, this doable with Applescript. This version below pretty simple, but I'll add prompting for file name.


    tell application "Finder"
    set currentDir to (target of front Finder window) as text
    end tell

    tell application "Microsoft Excel"
    set myWorkbook to make new workbook
    save workbook as myWorkbook filename currentDir & "saveasme"
    end tell
     
  8. bernuli macrumors 6502

    Joined:
    Oct 10, 2011
    #8
    Ok, so here is an applescript you can put into Automator. When you start up Automater, select service for your type of document.

    Drag the action "Run AppleScript" to the workflow panel.

    Then paste in the following

    tell application "Finder"
    try
    set currentDir to (target of front Finder window) as string
    on error
    set currentDir to path to desktop folder as string
    end try
    end tell

    display dialog "Specify file name: " & currentDir default answer ""
    set fileNameYo to the text returned of the result

    tell application "Microsoft Excel"
    activate
    set myWorkbook to make new workbook
    save workbook as myWorkbook filename currentDir & fileNameYo & ".xlsx"
    end tell

    Once you do that you can assign the service a keyboard shortcut that is accessible in the finder window you are in.



    automater.png keyboardPref.png
     
  9. bernuli, Dec 6, 2015
    Last edited: Dec 6, 2015

    bernuli macrumors 6502

    Joined:
    Oct 10, 2011
    #9
    Here is an AppleScript that will prompt you to choose Excel Word or PowerPoint. Runs as a keyboard shortcut (as a Service) for me in Finder to problem.

    I must be reinventing the wheel here. Surely someone has a script better than this.



    ---- Applescript to create a new Microsoft Office 2011 document within the frontmost opened folder in the Finder.
    ---- User is prompted for a file name. If the specified file already exists, script terminates to ensure that an existing file will not be overwritten. (Word save as AppleScript command clobbers by default.)

    ---- Get the frontmost Folder that is open in the Finder. Use Desktop if no windows open.
    tell application "Finder"
    try
    set currentDir to (target of front Finder window) as string
    on error
    set currentDir to path to desktop folder as string
    end try
    if currentDir = "" then set currentDir to path to desktop folder as string

    end tell


    ---- Choose which application new document will be for.
    set applicationList to {"Excel", "Word", "PowerPoint"}
    activate
    choose from list applicationList with prompt "Choose Application" default items "Excel"
    set applicationChoice to result as text

    ---- Prompt user for file name.
    display dialog "Location will be:" & linefeed & linefeed & currentDir & linefeed & linefeed & "Please choose a name for new " & applicationChoice & " document:" & linefeed & linefeed default answer ""
    set fileNameYo to the text returned of the result

    if fileNameYo = "" then
    display dialog "No file requested."
    return "nothing done"
    end if

    ---- Append application extension to specified file name according to applicationChoice.
    if applicationChoice = "Excel" then set fileNameYo to fileNameYo & ".xlsx"
    if applicationChoice = "Word" then set fileNameYo to fileNameYo & ".docx"
    if applicationChoice = "PowerPoint" then set fileNameYo to fileNameYo & ".pptx"

    ---- First make sure reqested file does not exist, ignore case in comparison. If file exists, script terminates with no action taken.
    set pathAndName to currentDir & fileNameYo

    tell application "Finder"
    ignoring case
    if exists file pathAndName then
    display alert "ERROR! File already exists." & linefeed & linefeed & pathAndName & linefeed & linefeed & "Exiting."
    return "nothing done"
    else
    display dialog "This new " & applicationChoice & " document will be created:" & linefeed & linefeed & pathAndName

    end if
    end ignoring
    end tell


    ---- Create new document file using the Application chosen in applicationChoice

    if applicationChoice = "Excel" then
    tell application "Microsoft Excel"
    activate
    set myWorkbook to make new workbook
    save workbook as myWorkbook filename pathAndName
    end tell
    end if

    if applicationChoice = "Word" then
    tell application "Microsoft Word"
    activate
    create new document
    save as active document file name pathAndName
    end tell
    end if

    if applicationChoice = "PowerPoint" then
    tell application "Microsoft PowerPoint"
    activate
    set myPres to make new presentation
    save myPres in pathAndName
    close myPres
    open pathAndName
    end tell
    end if
     
  10. Thessman macrumors regular

    Joined:
    Dec 8, 2005
    Location:
    GR
    #10
    You can also drag and drop the desirable folder onto the "save as" dialog to avoid navigating to it...
     

Share This Page