I'm writing a macro in VBA that creates a word document using
Sub WriteDocument()
wordapp = CreateObject("word.Application")
letter = wordapp.Documents.Add
TypeText()
wordapp.Visible = True
End Sub
Originally I'd tested this to satisfaction by running the macro and then closing the word document without saving it. Now that I'm actually saving the documents, the macro is taking longer and longer to run each time. I think the issue has to do with WINWORD.EXE and how it behaves if the document is saved or not.
I tried using
If wordapp Is Nothing Then
Set wordapp = CreateObject("word.Application")
End If
But now I'm getting errors if I run the macro repeatedly and without saving. Can someone explain the issue to me and help me resolve it?
Our company recently switched from Office 07 - Office 10. Would this affect anything? I noticed that new documents/spreadsheets always open in existing instances of Word/Excel instead of a new one.