Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Problem with script. May be simple. Object required

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,34268
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem with script. May be simple. Object required
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Problem with script. May be simple. Object required - 5/8/2006 4:36:55 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
I keep getting an error saying object required "secindex" 800a01a8.  The program is supposed to find out how many sections are in a document.  Then loop through all the sections and change the multiple carry forwards property.   Can someone help me.  

Function getsect()
     Dim sectcnt
     Dim secindex
     Dim i
sectcnt = Document.sectionCount()
MsgBox sectcnt
i=0
secindex = Document.section(i)

 do while secindex <> sectcnt
 secindex.allowMultipleCfds = 1
 i=i+1

 loop
End Function
 
 
Post #: 1
 
 RE: Problem with script. May be simple. Object required - 5/8/2006 7:11:31 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
There are some fundamental issues here:

1)When you are assigning objects to a variable, you need to use the set keyword:
Set secindex = Document.section(i)

2) Your Do loop is running while secindex <> sectcnt. secindex is an object and sectcnt is an integer. The wo will never be equal.

3) I don't know exactly what you want to do, but this may point you in the right direction:

Function getsect()
     Dim sectcnt
     Dim secindex
     Dim i
    sectcnt = Document.sectionCount()
   MsgBox sectcnt
    i=0
   do while secindex <> sectcnt
        Document.Section(i).allowMultipleCfds = 1
        i=i+1
    loop
End Function

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 2
 
 RE: Problem with script. May be simple. Object required - 5/10/2006 1:11:34 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
The script is supposed to loop through all the sections and change a property in the sections.  My logic here was to Find out how many sections in the document which is done by this statement


sectcnt = Document.sectionCount()


Then i would loop through all the sections and change the carryforwards property with these statements :


 do while i <> sectcnt
  Document.section(i)

Document.Section(i).allowMultipleCfds = 1
 
 
Thats all the script is doing. 

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Problem with script. May be simple. Object required - 5/10/2006 1:25:24 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Did you try the code that I posted?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 4
 
 RE: Problem with script. May be simple. Object required - 5/10/2006 1:37:15 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
I tried your code and i to the same thing Object Required: 'Document.Section(...)800a01a8


its in refrerence to this line of code


Document.Section(i).allowMultipleCfds = 1

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Problem with script. May be simple. Object required - 5/10/2006 2:04:41 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Are you sure that the Document object has an indexed collection called Section?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 6
 
 RE: Problem with script. May be simple. Object required - 5/10/2006 2:06:28 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
From the help in Word, it appears that the collection is called Sections not Section. Try that.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Problem with script. May be simple. Object required - 5/12/2006 1:52:03 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
My problem now is the fact that i keep getting the object required error in regards to setting secindex equal to document.section(i)
The program i am writing in is a proprietary software made by a canadian company  With that being said, the collection SECTIONS does not exist under the document object, instead it is called section.  I figure once i can assigned that object reference to that variable i can just put in the code that i want the function to execute inside the loop and i am done. 


function getsect()
 set secindex = Document.section(i)
sectcnt = Document.sectionCount()

MsgBox sectcnt
 
  'initialize loop counter to zero
i= 0  

MsgBox i

    
do while i <> sectcnt
'loop code here

    'increment loop counter
i= i+1 

End function

(in reply to ebgreen)
 
 
Post #: 8
 
 RE: Problem with script. May be simple. Object required - 5/12/2006 2:20:28 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
" The program i am writing in is a proprietary software made by a canadian company"

Are you writing this code in their software or are you writing code that is being run by the windows script host and simply using a COM object exposed by this other company's software?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 9
 
 RE: Problem with script. May be simple. Object required - 5/12/2006 6:45:32 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
I am writing code that is being run by the windows script host and simply using a COM object exposed by this other company's software

(in reply to ebgreen)
 
 
Post #: 10
 
 RE: Problem with script. May be simple. Object required - 5/12/2006 6:51:32 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Wihout knowing the object model of that application it will be really hard to figure out the problem. I would suggest talking to the company.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 11
 
 RE: Problem with script. May be simple. Object required - 5/12/2006 6:58:58 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
Thank you for all of your help. 

(in reply to ebgreen)
 
 
Post #: 12
 
 RE: Problem with script. May be simple. Object required - 5/17/2006 1:22:29 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
The object model goes like this


http://sdk.caseware.com/Reference/CVScripting/Hierarchy/CVScriptingModel-Image

(in reply to ebgreen)
 
 
Post #: 13
 
 RE: Problem with script. May be simple. Object required - 5/17/2006 1:34:09 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
I need to register to get there.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 14
 
 RE: Problem with script. May be simple. Object required - 5/19/2006 1:40:04 AM   
  enacada

 

Posts: 12
Score: 0
Joined: 4/5/2006
Status: offline
Here is the link to an image explaining the object model hierarchy http://www.megaupload.com/?d=A1DDPJ7F

(in reply to ebgreen)
 
 
Post #: 15
 
 RE: Problem with script. May be simple. Object required - 5/19/2006 3:16:29 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
From looking at that model, it appears that .Section is not a collection. If that is the case then you cannot use (i) to get different sections. I think you are going to need to find someone that has worked with this software before to figure out the way to script what you need.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to enacada)
 
 
Post #: 16
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem with script. May be simple. Object required Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts