Click here to Skip to main content
15,894,313 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerWhat was the solution ? [Got it] Pin
David Mujica13-Jul-10 3:57
David Mujica13-Jul-10 3:57 
GeneralRe: What was the solution ? Pin
Simon_Whale13-Jul-10 4:04
Simon_Whale13-Jul-10 4:04 
GeneralRe: What was the solution ? Pin
David Mujica13-Jul-10 4:05
David Mujica13-Jul-10 4:05 
GeneralRe: What was the solution ? Pin
HomeSen5-Aug-10 23:17
HomeSen5-Aug-10 23:17 
GeneralRe: What was the solution ? Pin
Bob Stanneveld30-Sep-11 9:20
Bob Stanneveld30-Sep-11 9:20 
AnswerRe: datagridview button column - text not displaying [Solved] Pin
Ajit Yagnesh23-Feb-11 1:38
Ajit Yagnesh23-Feb-11 1:38 
GeneralRe: datagridview button column - text not displaying [Solved] Pin
Simon_Whale23-Feb-11 1:40
Simon_Whale23-Feb-11 1:40 
QuestionOffice interop printing problem Pin
mSh198530-Mar-10 22:06
mSh198530-Mar-10 22:06 
Not really a visual basic problem, but i didnt know what forum to use, but my code is in vb.net Smile | :)
I have a program which has to print a bunch of documents, after printing a random number of documents this error is thrown: "Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) "

I have written this testprogram which throws the same error

Imports wrd = Microsoft.Office.interop
    ...
    Private Shared moapp As wrd.Word.Application
    Private Shared odoc As wrd.Word.Document
    ...

Private Sub test()
moapp = New wrd.Word.ApplicationClass().Application
    For i As Integer = 0 To 100
        odoc = moapp.Documents.Add("\\bur-131.cmc.Be\Tools\INFORMATICA\ZZorg\bevestziek.doc")
        moapp.Selection.GoTo(What:=wrd.Word.WdGoToItem.wdGoToBookmark, Name:="bwNaam")
        With moapp.ActiveDocument.Bookmarks
            .DefaultSorting = wrd.Word.WdBookmarkSortBy.wdSortByName
            .ShowHidden = False
        End With
        moapp.Selection.TypeText(Text:="whoopie" & i.ToString())

        sOriginalPrinter = moapp.ActivePrinter
        moapp.ActivePrinter = "\\S31W40F\PRINT075"   
          
        With moapp.ActiveDocument.PageSetup
            .FirstPageTray = 261 '257
            .OtherPagesTray = 261 '257
        End With

moapp.Application.PrintOut(FileName:="", Range:=wrd.Word.WdPrintOutRange.wdPrintAllDocument, Item:= _
wrd.Word.WdPrintOutItem.wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wrd.Word.WdPrintOutPages.wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0)
           
        While moapp.BackgroundPrintingStatus = 0
        End While
            
        moapp.ActivePrinter = sOriginalPrinter

        odoc.SaveAs("C:\somelocation\temp.doc")
            
        odoc.Close()
     Next

        System.Runtime.InteropServices.Marshal.ReleaseComObject(odoc)
        odoc = Nothing
        moapp.Quit()
        System.Runtime.InteropServices.Marshal.ReleaseComObject(moapp)
        moapp = Nothing
        GC.Collect()
        GC.WaitForPendingFinalizers()
End Sub


Sometimes it throws the error when opening the document, the other time when printing the document..
The problem occurs on a Vista Enterprise SP1, Office 2003 and only on a HP Laserjet 2430dtn printer. On another type of printer the code runs perfect, also on a win2000 the code runs perfect. I tried installing other drivers for this printer, same problem...

Does anyone have an idea what i can try to solve or work around this problem. I know my code works when i close word and close the document and call the garbagecollector for each document, but then it takes about 17 seconds per document to print out...

If i don't print at all it also works Poke tongue | ;-P

Thanks in advance.
Questionhelp with displaying hierarchical data in treeview in Visual Basic 2005 Pin
kim67830-Mar-10 21:10
kim67830-Mar-10 21:10 
QuestionNewbie to VB Pin
willwilco30-Mar-10 15:10
willwilco30-Mar-10 15:10 
AnswerRe: Newbie to VB Pin
_Damian S_30-Mar-10 16:05
professional_Damian S_30-Mar-10 16:05 
AnswerRe: Newbie to VB Pin
Wayne Gaylard30-Mar-10 20:38
professionalWayne Gaylard30-Mar-10 20:38 
GeneralRe: Newbie to VB Pin
willwilco31-Mar-10 13:41
willwilco31-Mar-10 13:41 
AnswerRe: Newbie to VB Pin
The Man from U.N.C.L.E.31-Mar-10 7:07
The Man from U.N.C.L.E.31-Mar-10 7:07 
GeneralRe: Newbie to VB Pin
willwilco31-Mar-10 13:42
willwilco31-Mar-10 13:42 
QuestionTwo RadioButtonList.SelectedIndex Values Changed Simultaneously - What am I Doing Wrong? Pin
johnaparker30-Mar-10 11:11
johnaparker30-Mar-10 11:11 
AnswerRe: Two RadioButtonList.SelectedIndex Values Changed Simultaneously - What am I Doing Wrong? Pin
pdnet1-Apr-10 21:46
pdnet1-Apr-10 21:46 
GeneralRe: Two RadioButtonList.SelectedIndex Values Changed Simultaneously - What am I Doing Wrong? Pin
johnaparker3-Apr-10 4:28
johnaparker3-Apr-10 4:28 
Questionhow can i catch form event keydown if my form has datagridview control ? Pin
xingselex30-Mar-10 6:36
xingselex30-Mar-10 6:36 
AnswerRe: how can i catch form event keydown if my form has datagridview control ? Pin
Abhinav S30-Mar-10 6:48
Abhinav S30-Mar-10 6:48 
AnswerRe: how can i catch form event keydown if my form has datagridview control ? Pin
dan!sh 30-Mar-10 6:49
professional dan!sh 30-Mar-10 6:49 
QuestionVB 2008 DataGridView Pin
Filippo197430-Mar-10 5:46
Filippo197430-Mar-10 5:46 
AnswerRe: VB 2008 DataGridView Pin
dan!sh 30-Mar-10 6:12
professional dan!sh 30-Mar-10 6:12 
AnswerRe: VB 2008 DataGridView Pin
Filippo197430-Mar-10 6:18
Filippo197430-Mar-10 6:18 
GeneralRe: VB 2008 DataGridView Pin
Filippo197430-Mar-10 10:12
Filippo197430-Mar-10 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.