CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: 462 Error

  1. #1
    Join Date
    Jun 2002
    Location
    Lyman ME - USA | Oneonta NY - USA
    Posts
    399

    462 Error

    I'm getting an error whenever i had a document open and then it isn't anymore. IE.
    I open an instance of word and set an object to control it..well when i close the document and look for word again i shouldn't find it so it creates another instance of it...prints out the text needed and theni have it try to extend the margins and it pops giving me the error...my code to check the word object is
    Code:
    Public Function prepRPT()
    On Error Resume Next
        Set wordApp = GetObject(, "Word.Application")
        If Err.Number <> 0 Then Set wordApp = Nothing
        If wordApp Is Nothing Then
            Set wordApp = CreateObject("Word.Application")
        End If
        DoEvents
        If wordApp.Documents.Count = 0 Then wordApp.Documents.Add
    End Function
    This is the code i am using to call this check and the printouts....
    Code:
            Do Until rsT.EOF
                prepRPT
                For i = colData.Count - 1 To 0 Step -1
                    colData.Remove (i)
                Next i
                For f = 0 To rsT.Fields.Count - 1
                    colData.Add rsT.Fields(f).Value, rsT.Fields(f).Name
                Next
                If bolLists = False Then
                    printRPT colData, cmbLists.Text
                Else
                    prtLists colData, cmbLists.Text
                End If
                Set colData = Nothing
                rsT.MoveNext
            Loop
            prepRPT
            wordApp.ActiveDocument.Range.Select
            wordApp.Selection.PageSetup.RightMargin = InchesToPoints(0.25)
            wordApp.Selection.PageSetup.LeftMargin = InchesToPoints(0.25)
    and i have Public wordapp as word.application in a module....

    thank you for the help

    - nc
    "In a world without walls and barriers, what need is there for windows and gates!" - a mac ad
    "What was the best thing before sliced bread and when did sliced bread go out of existence?" - me
    "Software is like sex, it's better when it's free." - Linus Torvalds <- gotten from Andreas Masur


    Live Penguine! - Tux the linux mascot
    Vivez le penguine!, íViva en penguine!, Lang lebe der Pinguin!, Viva no penguine!, Viva sul penguine!

  2. #2
    Join Date
    Jun 2002
    Location
    Lyman ME - USA | Oneonta NY - USA
    Posts
    399

    *****RESOLVED***** 462 Error

    Originally posted by booogt
    wordApp.Selection.PageSetup.RightMargin = InchesToPoints(0.25)
    wordApp.Selection.PageSetup.LeftMargin = InchesToPoints(0.25)
    i feel like an idiot

    i had to put wordapp. before inchestopoints

    *bows his head in shame*....
    hope it helps everyone

    - nc
    "In a world without walls and barriers, what need is there for windows and gates!" - a mac ad
    "What was the best thing before sliced bread and when did sliced bread go out of existence?" - me
    "Software is like sex, it's better when it's free." - Linus Torvalds <- gotten from Andreas Masur


    Live Penguine! - Tux the linux mascot
    Vivez le penguine!, íViva en penguine!, Lang lebe der Pinguin!, Viva no penguine!, Viva sul penguine!

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Wink ....Feel like a developer...

    No, you shopuld not feel too bad: everyone from time to time makes some mistake - we all are developers, not robots...

    Have a nice day,

    Cesare I.

    Btw: 5 stars to have resolved it
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)