Hello everyone.
I have developed an application in vb6 where an administrator can allocate individual staff to tasks through an interface. When the administrator saves the data a macro is called to print a Word 2010 document summarising the data. I have inserted the functionality to pri nt multiple Word documents when mltiple staff are assigned tasks. Unfortunately only the first document prints. Before the next document completes I get a Window that asks whether I want to open the document in Read-Only format. The code I have used in the macro is
Set wrdapp = CreateObject("Word.Application")
Set wrdoc = wrdapp.Documents.Open(App.Path & "\Application for Professional Learning Activity.doc")
wrdoc.SaveAs2 App.Path & "\PD Application Response for " & staff & ".doc"
"Application for Professional Learning Activity.doc" is a Word document I have already created with pre-formatted tables to display the relevant data for each staff
In the third line of the code I change the name of the file to reflect the staff involved
The first document opens up OK but the next one does not and the line where I set wrdoc to the original document is highlighted.
I tried setting wrdoc and wrdapp to nothing after setting wrdapp to 'visible' but the error still happens.
Anyone have an idea how to fix this?
Tim Christopher
I have developed an application in vb6 where an administrator can allocate individual staff to tasks through an interface. When the administrator saves the data a macro is called to print a Word 2010 document summarising the data. I have inserted the functionality to pri nt multiple Word documents when mltiple staff are assigned tasks. Unfortunately only the first document prints. Before the next document completes I get a Window that asks whether I want to open the document in Read-Only format. The code I have used in the macro is
Set wrdapp = CreateObject("Word.Application")
Set wrdoc = wrdapp.Documents.Open(App.Path & "\Application for Professional Learning Activity.doc")
wrdoc.SaveAs2 App.Path & "\PD Application Response for " & staff & ".doc"
"Application for Professional Learning Activity.doc" is a Word document I have already created with pre-formatted tables to display the relevant data for each staff
In the third line of the code I change the name of the file to reflect the staff involved
The first document opens up OK but the next one does not and the line where I set wrdoc to the original document is highlighted.
I tried setting wrdoc and wrdapp to nothing after setting wrdapp to 'visible' but the error still happens.
Anyone have an idea how to fix this?
Tim Christopher