Solved

VB script help

Posted on 2008-09-29
4
178 Views
Last Modified: 2012-05-05
Hi,

I have a VB script that needs to be modified.

The script is supposed to get the sum of price and shipping from several sellers on Amazon and re-price my item against the smallest sum.

See below the portion that has to be modified.  

There is a lists the properties and methods available that I can provide .

Thanks,
akiles

' Find the lowest seller that is not me
    '
    LowSeller = ""
    For i = 0 To .sellerspassed - 1
        If .sellername(i) <> .mynickname Then
            LowSellerPrice = .sellerprice(i)
            LowSeller = .sellername(i)
            Exit For
        End If
    Next
    If LowSeller <> "" Then
         ' Deal with at least one seller found
        If InStr(1,Sellers,LowSeller & ";", vbTextCompare) <> 0 Then
            '
            ' Find the seller in the array
            '
            LowSellerArray = Split(Sellers, ";")
            LowShipCostArray = Split(ShipCosts, ";")
            ' Verify that arrays are correct size
            If UBound(LowSellerArray) <> UBound(LowShipCostArray) Then
                MSGBox "Array elements are different - " & UBound(LowSellerArray) & "\" & UBound(LowShipCostArray)
                MSGBox Sellers
                MSGBox ShipCosts
                Exit Function
            End If
            
            LowShipCost = -1
            For i = LBound(LowSellerArray) To UBound(LowSellerArray)
                If StrComp(LowSeller, LowSellerArray(i), vbTextCompare) = 0 Then
                    LowShipCost = LowShipCostArray(i)
                    Exit For
                End If
            Next
            If LowShipCost = -1 Then
                MSGBox "Unable to locate " & LowSeller & " seller in array"
                MSGBox Sellers
                MSGBox ShipCosts
                Exit Function
            End If
            
        Else
            ' Use the default ship cost
            LowShipCost = DefaultShipCost
        End If
        
        '
        ' Do the arithmetic to calculate price
        '
        .myprice = LowSellerPrice + LowShipCost - MyShipCost - 0.01

Open in new window

0
Comment
Question by:akiles99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:KUBIS
ID: 22605159
Your "problem" is in wrong if case. In your case your lowest price is the first price, that is different from your nick name. It should be like this:
    LowSeller = ""
    LowSellerPrice = .sellerprice(0)*5 ' for comapare ony, it should be big enough 
    For i = 0 To .sellerspassed - 1
        IF i=0 then 
        If .sellername(i) <> .mynickname Then
            if .sellerprice(i)<LowSellerPrice then 'lets compare
              LowSellerPrice = .sellerprice(i)
              LowSeller = .sellername(i)
              Exit For
            endif
        End If
    Next i

Open in new window

0
 
LVL 1

Accepted Solution

by:
KUBIS earned 500 total points
ID: 22605197
Ups . delete line 4
right way

hope it helps.



    LowSeller = ""
    LowSellerPrice = .sellerprice(0)*5 
    For i = 0 To .sellerspassed - 1
        If .sellername(i) <> .mynickname Then
            if .sellerprice(i)<LowSellerPrice then 'lets compare
              LowSellerPrice = .sellerprice(i)
              LowSeller = .sellername(i)
              Exit For
            endif
        End If
    Next i

Open in new window

0
 

Author Comment

by:akiles99
ID: 22605222
Hi sorry ,

I forget to delete this question.Anyway i will grade it.

The help i need is:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_23774357.html

Same as this but the needs u can check there.

Please help me on this.

Thanks,
akiles
0
 

Author Closing Comment

by:akiles99
ID: 31501458
Thanks.
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question