If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Save as other formats in Word 2007
Office 2007
I have added the 'save as other formats' button to my quick access toolbar but is it possible to change the default format for this button to a different format than the normal save button ie PDF I poduve a lot of docs in word but then nedd to save them in the same directory as PDF's. Icurrently us 'Save As' then choose PDF. If I can change the default format for just the 'save as other formats' it will make things a bit simpler. Thanks in advance |
#2
|
|||
|
|||
Save as other formats in Word 2007
Mark Dullingham wrote:
Office 2007 I have added the 'save as other formats' button to my quick access toolbar but is it possible to change the default format for this button to a different format than the normal save button ie PDF I poduve a lot of docs in word but then nedd to save them in the same directory as PDF's. Icurrently us 'Save As' then choose PDF. If I can change the default format for just the 'save as other formats' it will make things a bit simpler. Thanks in advance You can't change the behavior of the "Save as other formats" button. You could write a macro that would display the Save As dialog with a different file type. But if you want the PDF to have the same base filename with the ..pdf extension, you might as well just have the macro do the save without showing the dialog. Put this macro into your Normal.dotm template (see http://www.gmayor.com/installing_macro.htm if needed): Sub SaveAsPDF() Dim fn As String Dim fnpath As String fn = ActiveDocument.Name fnpath = WordBasic.FileNameInfo(fn, 5) fn = fnpath & _ WordBasic.FileNameInfo(fn, 4) & ".pdf" ActiveDocument.SaveAs _ FileName:=fn, _ FileFormat:=wdFormatPDF End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#3
|
|||
|
|||
Save as other formats in Word 2007
Jay,
That works great except it always sves in 'My Documents' not in the folder the original document was opened from . My knowledge of VBA is limited and although I can see were the file path is derived from I don't know how to modify it. Also (this is a minor thing) is it posible toloose the '.docx' estionsion from the pdf file name. Is this something to do with - fn = fnpath & _ WordBasic.FileNameInfo(fn, 4) & ".pdf" part of the code. Many thanks in advance "Jay Freedman" wrote: Mark Dullingham wrote: Office 2007 I have added the 'save as other formats' button to my quick access toolbar but is it possible to change the default format for this button to a different format than the normal save button ie PDF I poduve a lot of docs in word but then nedd to save them in the same directory as PDF's. Icurrently us 'Save As' then choose PDF. If I can change the default format for just the 'save as other formats' it will make things a bit simpler. Thanks in advance You can't change the behavior of the "Save as other formats" button. You could write a macro that would display the Save As dialog with a different file type. But if you want the PDF to have the same base filename with the ..pdf extension, you might as well just have the macro do the save without showing the dialog. Put this macro into your Normal.dotm template (see http://www.gmayor.com/installing_macro.htm if needed): Sub SaveAsPDF() Dim fn As String Dim fnpath As String fn = ActiveDocument.Name fnpath = WordBasic.FileNameInfo(fn, 5) fn = fnpath & _ WordBasic.FileNameInfo(fn, 4) & ".pdf" ActiveDocument.SaveAs _ FileName:=fn, _ FileFormat:=wdFormatPDF End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#4
|
|||
|
|||
Save as other formats in Word 2007
Hi Mark,
I haven't been able to reproduce either of the situations you described. The WordBasic.FileNameInfo function is one of several functions that were never fully converted from the old WordBasic language to VBA. There's a description of it at http://www.word.mvps.org/FAQs/Macros...icCommands.htm. The numeric argument tells the function what part of the file name or path to return. The 5 says to return the path without the filename, and the 4 says to return the filename without the extension. In my tests these behave as advertised, even with paths on Windows 7 and with .docx extensions. As an example, if I open the document C:\temp\greek\Greek.docx and run the macro, it creates C:\temp\greek\Greek.pdf. As a troubleshooting procedure, open the Locals window in the VBA editor and run the macro one statement at a time by pressing F8. Watch the values of fnpath and fn in the Locals as the macro executes. What happens at each step? On Fri, 14 Aug 2009 02:37:01 -0700, Mark Dullingham wrote: Jay, That works great except it always sves in 'My Documents' not in the folder the original document was opened from . My knowledge of VBA is limited and although I can see were the file path is derived from I don't know how to modify it. Also (this is a minor thing) is it posible toloose the '.docx' estionsion from the pdf file name. Is this something to do with - fn = fnpath & _ WordBasic.FileNameInfo(fn, 4) & ".pdf" part of the code. Many thanks in advance "Jay Freedman" wrote: Mark Dullingham wrote: Office 2007 I have added the 'save as other formats' button to my quick access toolbar but is it possible to change the default format for this button to a different format than the normal save button ie PDF I poduve a lot of docs in word but then nedd to save them in the same directory as PDF's. Icurrently us 'Save As' then choose PDF. If I can change the default format for just the 'save as other formats' it will make things a bit simpler. Thanks in advance You can't change the behavior of the "Save as other formats" button. You could write a macro that would display the Save As dialog with a different file type. But if you want the PDF to have the same base filename with the ..pdf extension, you might as well just have the macro do the save without showing the dialog. Put this macro into your Normal.dotm template (see http://www.gmayor.com/installing_macro.htm if needed): Sub SaveAsPDF() Dim fn As String Dim fnpath As String fn = ActiveDocument.Name fnpath = WordBasic.FileNameInfo(fn, 5) fn = fnpath & _ WordBasic.FileNameInfo(fn, 4) & ".pdf" ActiveDocument.SaveAs _ FileName:=fn, _ FileFormat:=wdFormatPDF End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
Thread Tools | |
Display Modes | |
|
|