I have a C# WinForms app and am trying to print labels from it. I need to
print a label each time a certain type of record is added, so I need to print
labels one at a time. I set up a Word application and it worked fine for other
purposes, but when I added this code I get the error:
"method or property is not available because a document window is not active"
Here is the code:
bool SingleLabel = true;
object Name = "4013";
object Address = ClName.Text +"\r\nTest Company Name\tTest Rep";
oWord.Application.MailingLabel.DefaultPrintBarCode = false;
//First I tried this line
oWord.Application.MailingLabel.CreateNewDocument(ref Name,ref Address,ref missing,ref missing,ref missing);
//Then I tried this line
oWord.Application.MailingLabel.PrintOut(ref Name,ref Address,ref missing,ref missing,ref SingleLabel, ref missing,ref missing);
I saw similar code in numerous examples and do not know what is missing. In one place there was a suggestion that it could be a MS bug and to be sure I had Office SP3, but I upgraded it only to get same results. Word version is 9.0.6926 SP-3.
Any help is appreciated. I did not think this would be difficult but now it is threatening my deadline!!!!!!!!!!!!!!!!!!!