Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21719

Trouble opening multiple documents through vb6

$
0
0
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

Viewing all articles
Browse latest Browse all 21719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>