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 / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

application error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phil - 16 Dec 2004 11:02 GMT
when I run the code below I get the run time error 287
application-defined or object-defined error
whats causing this error i cant figure it out
I just  change to windows xp from 98 and this ran fine on the other machine
so can someone point me in the right direction
many thanks Phil

 Private Sub cbroo_main_Change()
   Dim sourcedoc As Document, i As Long, myitem As Range
   cbroo_profile.Clear
    Set sourcedoc = GetObject("c:\schedule\supplier\roofing.doc")
   For i = 1 To sourcedoc.Tables(1).Cell(cbroo_main.ListIndex + 2,
2).Range.Paragraphs.Count
      Set myitem = sourcedoc.Tables(1).Cell(cbroo_main.ListIndex + 2,
2).Range.Paragraphs(i).Range
      myitem.End = myitem.End - 1
      cbroo_profile.AddItem myitem.Text
   Next i
sourcedoc.Close SaveChanges:=wdDoNotSaveChanges
   End Sub

Private Sub UserForm_Initialize()
  Dim sourcedoc As Document, i As Long, myitem As Range
   Set sourcedoc = GetObject("c:\schedule\supplier\roofing.doc")
   For i = 2 To sourcedoc.Tables(1).Rows.Count
      Set myitem = sourcedoc.Tables(1).Cell(i, 1).Range
      myitem.End = myitem.End - 1
      cbroo_main.AddItem myitem.Text
       Next i
End Sub

    Private Sub cbroo_profile_Change()
   cbroo_thickness.Clear
   Dim sourcedoc As Document, i As Long, myitem As Range
   If cbroo_profile.ListIndex >= 0 Then
       Set sourcedoc = GetObject("c:\schedule\supplier\roofing.doc")
       Set myitem = sourcedoc.Tables(1).Cell(cbroo_main.ListIndex + 2,
3).Range.Paragraphs(cbroo_profile.ListIndex + 1).Range
       cbroo_thickness.List = Split(myitem, ",")
       sourcedoc.Close SaveChanges:=wdDoNotSaveChanges
End If
   End Sub
Word Heretic - 17 Dec 2004 12:33 GMT
G'day "Phil",

Set SourceDoc = Documents.Open("c:\schedule\supplier\roofing.doc")

etc

No comments, some strange code decisions.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

"Phil" <phespe remove this bigpond.net.au> reckoned:

>        Set sourcedoc = GetObject("c:\schedule\supplier\roofing.doc")
 
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.