Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 01-29-2019, 01:32 PM
macropod's Avatar
macropod macropod is offline run-time error 4605 command not available with Selection.paste Windows 7 64bit run-time error 4605 command not available with Selection.paste Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Aside from the fact the code in post #7 doesn't use .PasteAppendTable, your code works OK for me. Your code is very inefficient (e.g. nothing need ever be selected) and cluttered, though. For example, all of:
Code:
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then
                ActiveWindow.ActivePane.View.Type = wdPageView
            Else
                ActiveWindow.View.Type = wdPageView
            End If
            
            ActiveDocument.Save
            
            Selection.HomeKey Unit:=wdStory
            Application.ScreenUpdating = True
            If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
                ActiveWindow.Panes(2).Close
            End If
            If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
                ActivePane.View.Type = wdOutlineView Then
                ActiveWindow.ActivePane.View.Type = wdPrintView
            End If
            ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
            ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
'            Selection.WholeStory
'    Selection.Font.Name = "Tahoma"
'    Selection.Font.Size = 10
    ActiveWindow.ActivePane.VerticalPercentScrolled = 0
    ActiveDocument.Save
     ActiveDocument.SaveAs FileName:=UsPath + "\OffSwrm.doc", FileFormat:= _
            wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
            True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
            False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
            SaveAsAOCELetter:=False
        ActiveDocument.ExportAsFixedFormat OutputFileName:= _
        UsPath + "\OffSwrm.pdf", ExportFormat:=wdExportFormatPDF, _
        OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
        wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
        IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
        wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
        True, UseISO19005_1:=False
could be reduced to:
Code:
ActiveDocument.SaveAs2 FileName:=UsPath + "\OffSwrm.doc", FileFormat:=wdFormatDocument, AddToRecentFiles:=False
ActiveDocument.SaveAs2 FileName:=UsPath + "\OffSwrm.pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
Likewise, you can do away with:
Code:
 If ActiveWindow.View.SplitSpecial = wdPaneNone Then
'        ActiveWindow.ActivePane.View.Type = wdNormalView
    Else
'        ActiveWindow.View.Type = wdNormalView
    End If
You should also declare all your variables - and only define those you actually use.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Error Message Run time Error 4605 baes10 Word VBA 1 08-30-2018 02:37 PM
run-time error 4605 command not available with Selection.paste Error 4605 when looping through files in folder and deleting comments Peterson Word VBA 2 04-19-2018 08:45 AM
run-time error 4605 command not available with Selection.paste Selection.Click command? or something similar? mrlemmer11 Word VBA 1 07-06-2015 09:17 PM
PasteAppendTable not available (Run-Time Error 4605) q_scribe Word VBA 1 08-12-2013 09:56 AM
run-time error 4605 command not available with Selection.paste Edit Links Command Selection nkg Word 1 02-19-2012 07:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft