Results 1 to 5 of 5

Save Word Document to New Location Using Excel VBA

Threaded View

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    Port Orchard, Washington
    MS-Off Ver
    Excel 2007
    Posts
    4

    Save Word Document to New Location Using Excel VBA

    I have code that establishes a file location to save and it works for saving the Excel just fine. I need to also open a Word Document in Read Only and save a copy to the new location (the template can be opened by multiple people at any time). Here is the code I have but it fails at the ActiveDocument.SaveAs line.

    Dim wordapp As Object
    Dim SavePath As String
    Dim TempFilePath As String
    
    SavePath = Application.ActiveWorkbook.Path                
    TempFilePath = SavePath & "\"
    
                    Set wordapp = CreateObject("word.Application")
    
                    wordapp.Documents.Open ("T:\Forms Template - All States\RCS\Issues Memo Appendix 9-5-6.doc"), ReadOnly:=True
    
                    wordapp.Visible = True
                    
                    MsgBox (TempFilePath & "Issues Memo Appendix 9-5-6")
                    
                    ActiveDocument.SaveAs FileName:=TempFilePath & "Issues Memo Appendix 9-5-6" + ".doc", FileFormat:=wdFormatDocument
    I get a Run-time error '424': Object Required.

    I tried changing the "Dim wordapp As Object" to "Dim wordapp as Word.Document" but get a Compile error: User-defined type not defined error, which causes the code to not run at all.
    Last edited by TMcKay; 03-03-2017 at 04:32 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. open, edit, and save a word document based on user response in excel 2010 VBA
    By cmccabe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2016, 03:13 PM
  2. Replies: 1
    Last Post: 01-18-2014, 09:32 PM
  3. Excel graph to Specifc Word Document location
    By jimbb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-23-2013, 06:13 AM
  4. Excel VBA Save a document created with word in both .doc and .html
    By Lavnpc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2012, 01:01 PM
  5. Replies: 1
    Last Post: 05-14-2009, 11:01 AM
  6. Replies: 6
    Last Post: 08-04-2006, 01:50 PM
  7. Data to a specific location into a word document
    By Adam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-08-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1