Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Contacts / December 2004

Tip: Looking for answers? Try searching our database.

Only 250 contacts read

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco B - 02 Dec 2004 12:54 GMT
Hello,
I looked around in several forums without to find anything about what
I'm trying to figure out since this morning. My problem ist hat I
would like to print labels via VB code from an Outlook.Selection of
Contacts. Everything works fine until this Outlook Contacts Selection
reaches the Number 250. For the rest of the selection Outlook
Selection returns an empty or invalid Contact item which results in an
Error (Err Number 13) like Type mismatch (I asume there is no Contact
Item really coming from this Selection.

Here some code:

Function generateDok(pcWordTemplate As String)
On Error GoTo ErrorHandler

  Dim loFolder As MAPIFolder
  Dim loItm As Object
  Dim loExplorer As Explorer
  Dim loSelection As Outlook.Selection
***
     
  If Not m_olApp.ActiveExplorer Is Nothing Then
     'Set a reference to the currently selected folder
     Set loExplorer = m_olApp.ActiveExplorer
     Set loFolder = loExplorer.CurrentFolder
     
     ***
     Set loSelection = loExplorer.Selection
             
     'Open Word invisibly
     Set loAppWord = GetObject(, "Word.Application")

  ***
     'Open a new letter based on the selected template
     loAppWord.Documents.Add (lcWordTemplate)
 
     For Each loItm In loSelection
        If loItm.Class = olContact Then ‘ the 250th element is a
Contact object but loItm seems to contain nothing ??
'------------------------------------------------------------------------------
'Here on the 250th element the call raises the Error
           loAppWord.Selection.TypeText (doAdresse(loItm,
pcWordTemplate))
'------------------------------------------------------------------------------
           'Check row number before moving to the next cell
           lvRow = loAppWord.Selection.Information(wdEndOfRangeRowNumber)
           loAppWord.Selection.MoveRight Unit:=wdCell
           'Check row number after moving to the next cell
           lvNewRow =
loAppWord.Selection.Information(wdEndOfRangeRowNumber)
           'If the cursor is still on the same row, go to the next
cell
           If (lvRow = lvNewRow) Then
              loAppWord.Selection.MoveRight Unit:=wdCell
           End If
        End If
     Next

     ***

  End If
 
***
   
ErrorHandlerExit:
  Exit Function

ErrorHandler:

  ***
End Function

It does not depend if the contact folder is locally or in the public
folder. In both cases the application stops with the error. Has anyone
had such a behavior before and how can I resolve it?
Marco B - 03 Dec 2004 07:20 GMT
Versions used:
Microsoft Office Outlook 2003
Microsoft Office Word 2003
Microsoft Windows XP Version 2002 Service Pack 1

This may help? Cheerios Marco
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.