Consulting

Results 1 to 6 of 6

Thread: Expected end of statement error

  1. #1
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location

    Expected end of statement error

    All four of these lines all fail at the first occurrence of the full stop, when trying to convert time degrees to decimal degrees to radians. What have I missed?
    txtRLat1.Value = "=(Left(txtLat1.Value, FIND(".",txtLat1.value)-1)+Mid(txtLat1.Value, _
    FIND(".",txtLat1.Value)+1,10)/60)*PI()/180"
    txtRLat2.Value = "=(Left(txtLat2.Value, FIND(".",txtLat2.value)-1)+Mid(txtLat2.Value, _
    FIND(".",txtLat2.Value)+1,10)/60)*PI()/180"
    txtRLong1.Value = "=(Left(txtLong1.Value, FIND(".",txtLong1.value)-1)+Mid(txtLong1.Value, _
    FIND(".",txtLong1.Value)+1,10)/60)*PI()/180"
    txtRLong2.Value = "=(Left(txtLong2.Value, FIND(".",txtLong2.value)-1)+Mid(txtLong2.Value, _
    FIND(".",txtLong2.Value)+1,10)/60)*PI()/180"
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    what does txtLat1.value look like ?

    is it a number or a string ?

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    You gotta double up your quote char inside a string to end up one embedded

    txtRLat1.Value = "=(Left(txtLat1.Value, FIND(""."",txtLat1.value)-1)+Mid(txtLat1.Value, FIND(""."",txtLat1.Value)+1,10)/60)*PI()/180"
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    @snb it represents a time gps figure such as 23.45.435

    @Paul, Yes that does the trick.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Lat1.Value = CRad(DMS2Dec(txtLat1.Value, "."))
    Function DMS2Dec(DMSDegree As String, Delimiter As String) As Double
    Dim tmp As Variant
    tmp = Split(DMSDegree, Delimiter, 3)
    DMS2Dec = CDbl(tmp(0)) + CDbl(tmp(1)) / 60 + CDbl(tmp(2)) / 3600
    End Function
    Function CRad(DecimalDegree As Double) As Double
    Const rad As Double = 3.14159265358979 / 180
    CRad = DecimalDegree * rad
    End Function
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  6. #6
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    Sub M_snb()
       c00 = "23.45.435"
       
       MsgBox = Evaluate(Replace(Replace(c00, ".", "+", , 1), ".", "/60+") & "/60^2") * Application.Pi / 180
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •