A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Save as other formats in Word 2007



 
 
Thread Tools Display Modes
  #1  
Old August 12th, 2009, 07:18 PM posted to microsoft.public.word.docmanagement
Mark Dullingham
external usenet poster
 
Posts: 15
Default 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  
Old August 12th, 2009, 08:39 PM posted to microsoft.public.word.docmanagement
Jay Freedman
external usenet poster
 
Posts: 9,488
Default 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  
Old August 14th, 2009, 10:37 AM posted to microsoft.public.word.docmanagement
Mark Dullingham
external usenet poster
 
Posts: 15
Default 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  
Old August 14th, 2009, 01:34 PM posted to microsoft.public.word.docmanagement
Jay Freedman
external usenet poster
 
Posts: 9,488
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.