Share via

ActiveDocument.Convert '**4605 This Command is not available***

Anonymous
2011-02-22T06:13:40+00:00

Hi again,

I added

ActiveDocument.Convert        (as mixed template environment ). It converts fine and macros continues save.

BUT when the FileSaveAs macro is run again on the document that is saved

Active.Document Convert         **throws 4605 error

BUT if I use

ActiveDocument.CompatibilityMode = True Then ActiveDocument.Convert

it doesn't CONVERT.

Any ideas please?

Option Explicit

Sub GetDir3()

Dim sPath As String, FileName As String, n As Long

Application.ScreenUpdating = False

Application.DisplayAlerts = False

With Application.FileDialog(msoFileDialogFolderPicker)

.InitialFileName = "Z:\FIRM\CLIENTS"  'set your own

.Show

sPath = .SelectedItems(1) & ""  'you need the extra slash here

End With

'MsgBox "You selected " & sPath

ActiveDocument.Convert      '**4605 This Command is not available***

FileName = InputBox("Type File Name - Client, Bob Smith", "File Save As")

If Dir(sPath & " " & FileName & " " & Format(Date, "dd-mm-yyyy") & ".docx") = "" Then

ActiveDocument.SaveAs (sPath & " " & FileName & " " & Format(Date, "dd-mm-yyyy") & ".docx")

Else

n = 1

Do While Dir(sPath & " " & FileName & n & " " & Format(Date, "dd-mm-yyyy") & ".docx") <> ""

n = n + 1

Loop

ActiveDocument.SaveAs sPath & " " & FileName & n & " " & Format(Date, "dd-mm-yyyy") & ".docx"    ' You were adding a double quote here

End If

Application.ScreenUpdating = True

Application.DisplayAlerts = True

End Sub


*** Email address is removed for privacy *** www.ribbonspace.com Documents and Ribbons. Simple Automation.

Microsoft 365 and Office | Install, redeem, activate | For home | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2011-02-22T12:15:49+00:00

    Thanks Tony.

    "Tony Jollans [MVP]" wrote in message news:*** Email address is removed for privacy ***...

     ActiveDocument.CompatibilityMode is a half baked, poorly documented, Long, not a Boolean.

    Depending on what condition you want to check for, you could either make explicit checks against the version constants (wdWord2003, etc.), or take a flyer and compare it to Application.Version which appears as though it ought to work into the future (it may not do what you want in future releases, of course!). What you can't do (apart from check it for being True) is check it against the obvious 'wdCurrent', which, as far as I can tell, will never be true.

     -- Enjoy,

    Tony

    http://www.WordArticles.com


    *** Email address is removed for privacy *** www.ribbonspace.com Documents and Ribbons. Simple Automation.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-02-22T10:43:39+00:00

    ActiveDocument.CompatibilityMode is a half baked, poorly documented, Long, not a Boolean.

    Depending on what condition you want to check for, you could either make explicit checks against the version constants (wdWord2003, etc.), or take a flyer and compare it to Application.Version which appears as though it ought to work into the future (it may not do what you want in future releases, of course!). What you can't do (apart from check it for being True) is check it against the obvious 'wdCurrent', which, as far as I can tell, will never be true.


    Enjoy,

    Tony

    www.WordArticles.com

    Was this answer helpful?

    0 comments No comments