Excel Visual Basic managing coordinate tuple type

0 votes

I'm attempting to automate an external program that provides API using excel visual basic macros. I am attempting to call a function using ProgAPI, an object I made to interface with the API.

ProgAPI.getcoordinate(map1, point1)

That would provide me with a coordinate in the form (x, y), which I've been informed is a tuple. When I do, I am unable to put the coordinate into a variable.

sub getcoor
dim coor as double
coor = ProgAPI.getcoordinate(map1, point1)
end sub

I'm assuming because (x,y) has 2 entries. Does anyone know how to store this tuple in visual basic?

Feb 4, 2023 in Others by Kithuzzz
• 38,010 points
423 views

1 answer to this question.

0 votes

A tuple can be saved as an array of two values. To store the coordinates as an array, you can change the code as follows:

Sub GetCoor()
    Dim coor() As Double
    coor = ProgAPI.getcoordinate(map1, point1)
End Sub

The coor variable is specified as a Double-type array in this code. The two values in the tuple will be saved in the array when you assign the outcome of ProgAPI.getcoordinate(map1, point1) to coor. Then, each value can be accessed by its index, such as coor(0) for the first value and coor(1) for the second.

answered Feb 4, 2023 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

Is there a way to test a formula result in excel and type it only once, all within one cell and not using a user defined function?

Use the Let function: =LET(Value,A1+B2+C4+G3+B4,IF(Value>10,"No",Value)) I hope this helps ...READ MORE

answered Jan 9, 2023 in Others by narikkadan
• 63,420 points
408 views
0 votes
1 answer

Excel VBA Type Mismatch calling Private Sub from ListBox_Click

Confusion: You must declare the parameter as ...READ MORE

answered Mar 18, 2023 in Others by narikkadan
• 63,420 points
360 views
0 votes
1 answer

Excel - How do I round a date type to the next hour if it is more than one minute

Add almost 30 minutes and it'll get ...READ MORE

answered Mar 27, 2023 in Others by narikkadan
• 63,420 points
205 views
0 votes
1 answer

Type the max number title in Excel

If you have duplicates and want to ...READ MORE

answered Apr 2, 2023 in Others by Kithuzzz
• 38,010 points
313 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
899 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
3,217 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
510 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,670 points
753 views
0 votes
1 answer

Using Visual Basic to pull data from within a range to use in an Excel function

Use AVERAGEIFS instead of the full range. ...READ MORE

answered Jan 14, 2023 in Others by narikkadan
• 63,420 points
304 views
0 votes
1 answer

Having issues with pop-up alert in excel. (Visual Basic)

You may find the following code of ...READ MORE

answered Feb 4, 2023 in Others by narikkadan
• 63,420 points
348 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP