-
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.
-
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.
-
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.