CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2005
    Posts
    4

    MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    I have a VB6 program that allows use of a created object instance of MS Word to produce letters and automatically save them in the appropriate directory as determined by my program, for example:

    objMSWordDocument.SaveAs C:\DISC\VER70\LOAN\DATA2\2\3\00049323.01\LETTERS\20140428124003.docx , wdFormatXMLDocument

    This works as designed on one machine running Windows 8.1 Professional 64-bit, but on another identical machine, instead of silently saving the document to the specified location, a Save Dialog opens that points to the Windows user's Documents directory.

    I assume this is a permissions issue, either in MS Word 2013, or Windows 8.1. My program is set to Run as Administrator.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    Does that folder exist on both machines?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2005
    Posts
    4

    Re: MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    Quote Originally Posted by dglienna View Post
    Does that folder exist on both machines?
    Yes (my program creates the folder if it does not already exist).

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    Issue a CD command, and then save it. That might be the issue.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Re: MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    I have a VB6 program that allows use of a created object instance of MS Word to produce letters and automatically save them in the appropriate directory as determined by my program, for example:
    objMSWordDocument.SaveAs C:\DISC\VER70\LOAN\DATA2\2\3\00049323.01\LETTERS\20140428124003.docx , wdFormatXMLDocument
    try to save your word doucumnet at the following way . hope it might help .
    Code:
    Private Sub MakeWordDoc(ByVal file_name As String, ByVal _
        title As String, ByVal body As String)
    Dim word_app As Word.Application
    Dim word_doc As Word.Document
    
        ' Open Word and create a document.
        Set word_app = New Word.Application
        Set word_doc = _
            word_app.Documents.Add(DocumentType:=wdNewBlankDocument)
        
        ' Write the title.
        word_app.Selection.TypeText title
        word_app.Selection.Style = _
            ActiveDocument.Styles("Heading 1")
        word_app.Selection.TypeParagraph
    
        ' Write the body.
        word_app.Selection.TypeText body
    
        ' Save the file.
        word_doc.SaveAs FileName:=file_name
    
        ' Close the document and Word.
        word_doc.Close False
        word_app.Quit False
    End Sub
    Last edited by firoz.raj; May 17th, 2014 at 01:55 AM.

  6. #6
    Join Date
    Aug 2014
    Posts
    2

    Re: MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    I'm getting the same problem on 2 Windows 8.1 PCs. One has Word 2013, the other Word 2007.
    When calling saveas, word will instead open a dialog in the users documents folder.
    The software I was using was an application written in vb.net express, however, I've rewritten it as a simple short vbs file, and I get the same thing. The vbs file look slike this:
    Dim Word, Doc, rngEnd
    Const wdFormatDocument = 0
    set Word = CreateObject("Word.Application")
    Word.visible = True
    set Doc = Word.Documents.Add
    set rngEnd = Doc.Range(Doc.Range.End - 1, Doc.Range.End)
    rngEnd.InsertFile("c:\evolvit\dgtest\a.doc")
    Doc.SaveAs "c:\evolvit\dgtest\out_a.doc", wdFormatDocument, False, "", True, "", False, False, False, False, False
    The same happen if I change the last line to simply be:
    Doc.SaveAs "c:\evolvit\dgtest\out_a.doc"
    Did you ever find the problem?

    Matt

  7. #7
    Join Date
    Aug 2014
    Posts
    2

    Re: MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory

    I've fixed this now. It was caused by a Word com addin called "Acer Cloud World". Disabling that addin made the problem go away.
    Matt

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured