MS Word saving a document to a specific directory

I have a very simple example:
tell application "Microsoft Word"
activate
open ":mypath:myfile.doc"
save as active document file name "test.pdf" file format format PDF
close active document
end tell
This saves the contents of myfile.doc in pdf format in a file called test.pdf. But it places this in ~/Documents.
I dont seem to be able to specify an alternative path in the file name argument. Either it ignores the path if I use something like:
"foo:test.doc"
or it explodes with an error for something like:
":foo:test.doc" where :foo is /foo.
I assume there is perhaps some kind of property.
Is there a more efficient way to learn MS Word and applescript? I know its not an apple product (dohhh). If this was windows and vbscript they allow you to record a macro and effectively it gives you the code.
error "Microsoft Word got an error: active document doesn’t understand the save as message." number -1708 from active document

Welcome to Apple Discussions!
To save in a different location to the default you need to provide a full path to the new location:
You could say ((path to desktop) as string) & "test.xxx" OR
"Macintosh HD:Users:yourusername:Desktop:text.xxx"
Note that if the file already exists, it will be overwritten without alerting you.
I am using Office 2004, which does not allow save as PDF. You might need to verify that this format is available in the version you are using. So, using RTF as the format, this works:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;">
tell application "Microsoft Word"
open (((path to documents folder) as string) & "Original Document.doc") as alias
save as active document file name (((path to desktop) as string) & "New Document.rtf") file format format rtf
close active document
end tell </pre>
To address your question about learning AS for Word, I assume you know that you can open the application's dictionary in Script Editor? (Descriptions can be somewhat obtuse, however.)

Similar Messages

  • How to respond to Word saving a document?

    Hi,
    We want to be able to edit .docx files with our application. We do this by writing them to disc and opening them with Word via ActiveX calls. As soon as the document is changed and saved in Word, we want to write it back to our application. What would be
    the best way to achieve this? There is a DocumentBeforeSave event but not a DocumentAfterSave event.
    Thank you very much for your help.

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Word,the issue is more related to Word coding/programing, I recommend you post the question to the MSDN forum for Word
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=worddev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no
    help.
    If you have any feedback on our support, please click "[email protected]"

  • Saving a PDF to a specific directory - using a shortcut

    We work with various applications that create PDF's and then we need to save them to one of several locations on a server. When you click on Save As (Shift+ctrl+s) you open a dialog box and then must drill for your directory. Is there a way to create a shortcut in this space as you can do in Windows? We could then list our favorites and avoid all the drilling we have to do every time we save.

    If it always opens to the same default folder, just place a shortcut there
    and then double-click it when the Save As dialog opens...
    On Fri, Aug 8, 2014 at 6:14 AM, Robertlopez <[email protected]>

  • Trouble using Custom Template and Saving Resulting Document. Help!

    I created a Custom Template in Numbers '09. When I go hit "New from Template Chooser", there it is. I've tried entering info directly into the template, as well as duplicating it and entering info in the duplicated document. I can enter the info just fine, but.... Either way, when I'm done I do not have an option to Save, Save As or anything like that. I only see "Save As Template".....but it's already a perfectly good template. I don't want to Save As Template and create another template!!!. I want a named document saved, using the great template I already put together. Is this a problem? What's up? Why can't I do this???? Please help!

    I'm on an iMac running 10.7.5. (Afraid to go further  because I have FInal Cut Pro 7 and I'm very attached to it....I'm afraid to upgrade my OS and have FCP not work! I'm a pro and not so willing to go to FCP 10).  Anyway, I'm on an iMac 3.06 GHz Intel Core  4 GB, 1333 MHz RAM.
    I'm running Numbers ''09 and don't have 13, so it's an 09 template entering 09 info. It's perfect. I run webinars and it contains all of the status for media and every detail of any upcoming webinar production. My goal is to open the template, enter the info, and save it with the name of the webinar client. Then open again, enter for another client, save, etc.
    It's just 09 all the way through. It says I can Save a Version or Save as Template.
    Should I open a template and then Duplicate so it's a fresh document? I do that sometimes in hopes of seeing an option to SAVE AS. Sometimes I open and Don't Duplicate, but just use the template. Either way I see no way of saving the document with the specific information for the client. I don't want to Save As Template! Who wants hundreds of templates running around that are all virtually the same except for the info entered within it.
    Am I missing the boat here?

  • Last night I downloaded the latest Word update. Today the first Word document crashed and I lost 45 minutes of work in spite of having saved the document numerous times. Why is Word crashing the day after a safety update? I have Office 2008 for Mac

    Last night I downloaded the latest Word update. Today the first Word document crashed and I lost 45 minutes of work in spite of having saved the document numerous times. Why is Word crashing the day after a safety update? I have Office 2008 for Mac

    One way to test is to Safe Boot from the HD, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, Test for problem in Safe Mode...
    PS. Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive
    Reboot, test again.
    If it only does it in Regular Boot, then it could be some hardware problem like Video card, (Quartz is turned off in Safe Mode), or Airport, or 3rd party add-on, Check System Preferences>Accounts>Login Items window to see if it or something relevant is listed.
    Check the System Preferences>Other Row, for 3rd party Pref Panes.
    Also look in these if they exist, some are invisible...
    /private/var/run/StartupItems
    /Library/StartupItems
    /System/Library/StartupItems
    /System/Library/LaunchDaemons
    /Library/LaunchDaemons
    Open Console in Applications>Utilities, check the system log for the date/time of the last problem  & next startup for clues.

  • I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks

    I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks

    I suggest you post your qeustion on the Microsoft Mac forums as it's their software you're having issues with and that's where the MS experts hang out
    http://answers.microsoft.com/en-us/mac

  • Saving a WORD or PDF document in the database?

    Hello,
    If I have a WORD document, PDF document or EXCEL document. How can I save them in the database? What type of LOB I should use.
    What I would like to do is have a webpage with a text box and a browse button. The user can then use the browse buttton to find the file and have its location inserted into the text box. Then the user can click another button to add the file to the database.
    Once the file is in the database - I also want to have an update page where the user can change the files saved in the database or delete them also
    Thanks
    Doug

    Well, Word and Excel documents are binary, so you will need a Binary LOB (BLOB).
    I have recently been storing/retrieving BLOBs through ASP/ADO . . .
    BLOBs are limited to 4GB, but ADO has a limit of 2GB. Hopefully, that will not be a problem.
    If you are using ODBC, then be aware that you need to enable LOBs by setting LOB=T in the connection string. If you are using ODBC with stored procedures, then there is a bug that causes the LOBs to be truncated to 32K, which is fixed in 9.2.0.6.5. A colleague tells me that the Microsoft ODBC Driver for Oracle works with LONGs but not with LOBs.
    If you are using OleDB with stored procedures, then you'll need to set the "SPPrmsLOB" property to TRUE.
    When uploading BLOBs through ADO, you need to set the parameter size to 1 higher than the actual size, otherwise you get an error.
    When retrieving the BLOBs through stored procedures as OUT parameters, you need to set the parameter size to larger than the BLOB, otherwise it gets truncated. I do not like having to specify 2GB for a file that might only be 32K, so I prefer to return a record set via a REF CURSOR.
    Tak

  • When I send open office documents to a PC user (even saved and sent in the word format), the document reaches with serious format changes and is rendered unusable to the PC user. How to overcome the problem??

    When I send open office documents to a PC user (even saved and sent in the word format), the document reaches with serious format changes and is rendered unusable to the PC user. How to overcome the problem??

    I don't use OpenOffice (I have it on my internal just to play around with, but seldom even open it). I do use MS Word and have few problems sharing files - it's usually a font issue so I tend to use MS fonts for documents that I know will need to be shared.
    Unless you need to make collaborative changed to the document, you could always save it as a pdf file. With Acrobat Pro you can even save a pdf file to a Word document with very little change in formatting.
    If I were you - and you have a need for .doc or .docx files to travel and play nicely - I'd just invest in MS Office. If you don't have to send a Word file, try pdf.
    Clinton

  • Microsoft Word saving documents as .docx

    I'm not sure if this is the right place to be posting the question- if there is a different forum that it belongs in please let me know!
    I downloaded Microsoft Office for Home & Student 2008, and now it is saving my documents as .docx. As a result, emailing Word attachments has proven itself troublesome as the recipients cannot open the files. I have tried altering the .docx to .doc, but it doesn't make any difference. Somewhere along the line the compatibility is being destroyed- I don't know what to do, or even where to start looking.
    Please help!
    Kelly Mae

    if there is a different forum that it belongs in please let me know!
    http://www.officeformac.com/productforums\
    I don't know what to do, or even where to start looking.
    File menu --> Save As.. --> Format --> Word 97-2004 Document

  • Need suggestion for searching words in a document

    Is there any option to search the words in a document, where I want to make a user designed words or phrases saved itself in a PDF docment. For e.g I need to search the data with words like Salary, Compensation, Remuneration, etc in an annual report (PDF Version). For which I need to type these words hundreds of times everyday. So if I have a option to upload these words in the adobe reader itself it will save most of my time. please help me with ur opinions and suggestions.

    Nothing in Reader itself. A macro program might help.

  • Does anyone know how to use pages so you can export pdfs from the internet and automatically drag words from the document into the file name of the pdf (i.e., author, title of a scientific paper)

    Does anyone know how to use pages so you can export pdfs from the internet and automatically drag words from the document into the file name of the pdf (i.e., author, title of a scientific paper). For example, if I am downloading a paper by smith called "Surgery" that was published in 2002, it will automatically set the file name in the download to smith- surgery 2002. I have heard pages is smart enough to do this.
    thank you

    Pages can export only its own documents. They may be exported as PDF, MS Word, RTF or Text files.
    Pages can import (ie. Open a file as, or Insert a file into, a Pages document) documents in several formats, but won't rename the document as you describe. Documents that can be Opened (eg. Text, AppleWorks 6 WP, MS Word files) are converted to Pages documents, and retain their original names, with .pages replacing the original file extension. Files that can be Inserted (generally .jpg, .pdf and other image files) become part of the existing Pages file and lose their names.
    It may be possible, using AppleScript, to extract the text you want and to Save a Pages file using that text as the filename, but that would depend in part on being able to identify which text is wanted and which is not.
    How will the script determine where the author's name begins and where it ends?
    How will the script recognize the beginning and of the title, an decide how much of the title to use in the filename?
    How will the script recognize the year of publication?
    For papers published in a specific journal, with a strict format for placing each of these pieces on information, or containing the needed information as searchable meta data in the file, this might be possible. But it would require knowledge of the structure of these files, and would probably handle only papers published in a specific journal or set of journals.
    Outside my field of knowledge, but there are some talented scripters around here who might want to take a closer look.
    Best of luck.
    Regards,
    Barry

  • What do I need to do to open Office (word AND excel) documents, PowerPC issues etc. They don't open on iWork '08. Office 2011? Please advise :-)

    What do I need to do to open Office 2004 (word AND excel) documents? PowerPC issues etc. They don't open on iWork '08. Happy to upgrade to iWork or Office just to be able to access my docs from Office 2004 again - please can someone advise? Cheers.

    Hi - thanks for this info. Actually I have downloaded a 30-day trial of MS Office for Mac 2011 and it reads/writes. But I was expecting that if I saved it again, either as xls oe xlsx, then I would be able to open the newly-saved document in iWorks '08. This is not the case, any ideas why? cheers, Matt.

  • When I download a saved Adobe document I am unable to edit it

    When I download a saved Adobe document I am unable to edit it., how do I edit such documents?

    Thank you Michael/
           Many of my files need periodic updating, which I can do with my Word documents. If I scan a document it is saved as an Adobe document and thus cannot be readily changed. Clearly I need to uninstall my Adobe program.
                                                                                    Bernard Huggins
    [private data removed]

  • Word and excel documents

    Am I correct that there is no way to edit my word and excel documents once they are on my Palm Pre??!!! I can't believe I went from a 5 year old smart phone to a new Pre and lost the ability to modify documents (with the promise of being able to do it in the future, and at what cost???).  What a rip off, I should have gone with droid technology!
    Post relates to: Pre p100eww (Sprint)

    Palm has not released specific information on whether an Office document editor will be included in webOS 2.0. However, speculation is rampant that QuickOffice will be releasing a document editor, either as part of 2.0 or as a stand-alone app.
    What we do know is that Dataviz, the company that produced the current doc viewer (as well as Documents To Go for Palm OS and other platforms), won't be producing an editing version for webOS in spite of their earlier promises. They're been purchased by RIM (Blackberry).
    smkranz
    I am a volunteer, and not an HP employee.
    Palm OS ∙ webOS ∙ Android

  • Word and Excel documents name changed after download?

    Hi everyone, I have upgraded my Macbook Pro 17 (2010) to latest Mac OS X 10.8, everything seemed to be ok. Later, I noticed that every time I download my Word or Excel documents and save on my desktop, the names of files which are in russian, change to hieroglyphs. Any other files with russian names are saved properly. So I have to rename the files I have downloaded, and if I rename the file with russian, it's ok. What is faulty with my Mac?

    Dekartus wrote:
    it seems people do not care.
    More likely "do not know".
    As asked before:  How exactly are you downloading these docs?
    If you are using Mail, have you tried webmail instead, or a different browser?

Maybe you are looking for