Results 1 to 3 of 3

Thread: Word 2010 Automation

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Location
    Cheshire
    Posts
    5

    Word 2010 Automation

    I have a problem with automating Word 2010 using a VB6.0 app on a Windows 7 PC. Every time the app tries to open a Word document the app crashes. I am using the following code:

    msw.Documents.Add ourmatx.location, False
    DoEvents

    msw.ActiveDocument.SaveAs2 ourmatx.location
    DoEvents

    msw.Visible = True

    ourmatx.location has the path to the file.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Word 2010 Automation

    What is the error you're receiving?
    What line of code generates the error?
    Does it work on other OSs (XP, etc)?
    What is value of ourmatx.location when code runs?
    If Path is valid current user may not have access to that folder?

    Please be much more specific when asking questions. Thanks.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Location
    Cheshire
    Posts
    5

    Re: Word 2010 Automation

    Thanks for the reply. However, I did a reinstall of Office 2010 and that particular problem is now solved. I do still have problems with Word 2010 documents though. My code has a global Word Object, msw. I open Word by stating Set msw = New Word.Application. I then use msw.documents.add to open a blank document and try to add text to it using msw.ActiveDocument.Range.Text = StringValue. The error I get is as follows: Run-time error 4248. This command is not available because no document is open. If I then debug and step though the code it works.

    If I try to use the msw.Open command that fails as well. This problem is across all our OS's, XP Pro, Vista and Windows 7.

    Any ideas or pointers would be appreciated.

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