Results 1 to 15 of 15

Thread: Save Active Word Doc with URL File Path

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Apr 2017
    Posts
    66
    Location

    Save Active Word Doc with URL File Path

    Working from Excel, I want to save active Word docs that have been retrieved from a data base and have a "URL" File Path like: http://fsc...../mot542.doc.

    The code below works with active Word docs retrieved from a standard C:\ Drive etc. But the URL File Path does not seem to be recognized even though the these documents have a .doc extension are open and active in Word.

    If there are no other Word docs open, the Error is # 4248
    This command is not available because no document is open
    If there are other Word docs open, one of the other docs will be saved instead of the active "URL Word doc".

    Sub ActiveURLWordDoc
    
        Dim objWord
        Dim objDoc As Object
        Set objWord = GetObject(, "Word.Application")
        objWord.Visible = True
        
    'Below works for Word docs with file path like: "C:\ ....mot542.doc"
    'But gives error when Word doc has a file path like: "http://fsc...../mot542.doc"
    
        Debug.Print objWord.ActiveDocument.FullName <-------------- ERROR 
    
         OrigDoc = objWord.ActiveDocument.FullName
    
        Set objDoc = objWord.Documents(OrigDoc)
    
         objDoc.Save
    
    End Sub
    Last edited by BrI; 01-24-2018 at 10:28 AM.

Posting Permissions

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