MS Word 2013 or Windows 8.1 coerces SaveAs path to user's Documents directory
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

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

  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
    Chicago, IL
    Posts
    14,945

    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
    Chicago, IL
    Posts
    14,945

    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
    464

    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.

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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center