Forum

Free Download More Info
Welcome to the Personal Stock Streamer Developers Forum. Anyone can read messages, but you must be a registered user in order to post. (Sorry, we did this in order to prevent forum spam.)

Everyone who is registered for the Developers Forum on this site should now also have permission to log in and post to the Support Forum.  This was done by hand, so we may have missed a couple of people.  Please let us know if you do not have access to both forums.
Subscribe to RSS Feed
PSS Developers Forum -> Where am I going wrong?
Not logged in.
2008-04-11 04:46:31
1 of 8
#1221
Code:

' get the active document
Dim document
dim SEvalPortfolio
dim EvalFolder

set document = application.ActiveDocument

set SEvalPortfolio = document.CreateFolder
   if (Not SEvalPortfolio Is Nothing) then
      SEvalPortfolio.Name = "Stock Evaluator"
      document.InsertPortfolio -1, SEvalPortfolio
      document.CurrentPortfolio = SEvalPortfolio
   end if

set EvalFolder = document.CreateFolder
   if (Not EvalFolder Is Nothing) then
      EvalFolder.Name = "Evaluations"
      SEvalPortfolio.Insert 1, EvalFolder '<== blows up here
      document.CurrentPortfolio = EvalFolder
   end if


The attempt here is to create a folder inside the portfolio folder. Then I plan to add a collection of tickers to this folder. Any ideas?

Larry E. Hayes
Investors Haven

Larry E. Hayes
Investors Haven
Posted by: lehayes
2008-04-11 07:05:49
2 of 8
#1226
in reply to #1221
In

> SEvalPortfolio.Insert 1, EvalFolder

You probably want

> SEvalPortfolio.Insert -1, EvalFolder

Let me know if that helps.

Also, you can't set the current portfolio to a child folder so the line after that will not work.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2008-04-11 11:50:40
3 of 8
#1228
in reply to #1226
Nope, that is an index, I want it in the first location, which is currently empty. -1 indicates last location. Also, I tried it with -1 and it still blew up.
      
Larry E. Hayes
Investors Haven

Larry E. Hayes
Investors Haven
Posted by: lehayes
2008-04-11 13:14:07
4 of 8
#1229
in reply to #1228
The first location would be index 0.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2008-04-11 13:15:27
5 of 8
#1230
in reply to #1229
Although -1 should have worked to add it at the end of the list of children. I will have to double-check that.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2008-04-12 04:58:07
6 of 8
#1232
in reply to #1230
Yep, that was it, subscript out of range... uugggh
      
Larry E. Hayes
Investors Haven

Larry E. Hayes
Investors Haven
Posted by: lehayes
2008-04-12 10:14:41
7 of 8
#1233
in reply to #1232
FWIW, I checked and -1 does work to insert the folder into the portfolio, but it blows up on the next line when you try to set the folder as the current portfolio, which is not allowed. Removing that line fixes it.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2008-04-12 11:03:59
8 of 8
#1234
in reply to #1233
Yep, ran into the same, removed the line and works fine. Then I got to thinking about your use of -1 logic, and realized that I can only get away with specifying the index for so long before user chooses to move things around on me. So I will be utilizing the -1 more frequently, for now, I just wanted to make sure it sent to the top. Hope I don't distract you too much, but I am going to be working on this for a little while.
      
Larry E. Hayes
Investors Haven

Larry E. Hayes
Investors Haven
Posted by: lehayes