Creating .ini file from excel using vba for gps co-ordinates

aniketjha21

New Member
Joined
May 13, 2016
Messages
5
Hi Guys,

i need help in creating an ini file for GPS co-ordinates ($GPRMC format).
Currently in excel i have latitude and longitude below is the attachement:

552003d1513251759-creating-ini-file-from-excel-using-vba-for-gps-co-ordinates-lat-lon.jpg
---- excel file

but need to create an .ini file in the format below:


[GPS Coords]
Coord1=$GPRMC,123519,A,1259.25378,N,7744.20074,E,022.4,084.4,230394,003.1,W*5D
Coord2=$GPRMC,123519,A,1259.2551,N,7744.13588,E,022.4,084.4,230394,003.1,W*63
Coord3=$GPRMC,123519,A,1259.26152,N,7744.13408,E,022.4,084.4,230394,003.1,W*5B
Coord4=$GPRMC,123519,A,1259.2593,N,7744.22726,E,022.4,084.4,230394,003.1,W*69

And in the calculate the checksum which is 5D, 63,5B,69 in examples above.


Pls help me creating vba script for above.

Thanks
Aniket
 
You cannot upload files to this site. But there are tools you can use to post screen images. They are listed in Section B of this link here: http://www.mrexcel.com/forum/board-a...forum-use.html.
Also, there is a Test Here forum on this board that you can use to test out these tools to make sure they are working correctly before using them in your question.
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You cannot upload files to this site. But there are tools you can use to post screen images. They are listed in Section B of this link here: http://www.mrexcel.com/forum/board-a...forum-use.html.
Also, there is a Test Here forum on this board that you can use to test out these tools to make sure they are working correctly before using them in your question.

Thanks for the advice.

I have completed the 75% problem with the help of labview, now for the rest 25% i still need the ini file from which co-ordinates to be read. Below is the format of ini file :
[GPS Coords]
Coord1=2226.575,11955.982
Coord2=2226.583,11955.983
Coord3=2226.586,11955.985
Coord4=2226.679,11956.015
Coord5=2226.683,11956.017
Coord6=2226.687,11956.018

Also, below is the excel file from where co-ordinates needs to be extracted (excel file) :

LatitudeLongitude
1259.7563527743.193616
1259.7617767743.193616
1259.76727743.193616
1259.7726247743.193616
1259.7780487743.193616
1259.7834727743.193616
1259.788897743.193616
1259.7943147743.193616
1259.7997387743.193616
1259.8051627743.193616
1259.8105867743.193616
1259.816017743.193616
1259.8214347743.193616
1259.8268587743.193616
1259.8322827743.193616
1259.8377067743.193616
1259.843137743.193616
1259.8485487743.193616
1259.8539727743.193616
1259.8593967743.193616
1259.864827743.193616
1259.8702447743.193616
1259.8756687743.193616
1259.8810927743.193616
1259.8865167743.193616
1259.891947743.193616
1259.8973647743.193616
1259.9027887743.193616
1259.9082067743.193616
1259.913637743.193616
1259.9190547743.193616
1259.9244787743.193616
1259.9299027743.193616
1259.9353267743.193616
1259.940757743.193616
1259.9461747743.193616
1259.9515987743.193616
1259.9570227743.193616
1259.9624467743.193616
1259.9678647743.193616
1259.9732887743.193616
1259.9787127743.193616
1259.9841367743.193616
1259.989567743.193616
1259.9949847743.193616
1300.0004087743.193616
1300.0058327743.193616
1300.0112567743.193616
1300.016687743.193616
1300.0221047743.193616
1300.0275287743.193616
1300.0329467743.193616
1300.038377743.193616
1300.0437947743.193616
1300.0492187743.193616
1300.0546427743.193616
1300.0600667743.193616
1300.065497743.193616
1300.0709147743.193616
1300.0763387743.193616
1300.0817627743.193616
1300.0871867743.193616
1300.092617743.193616
1300.0980347743.193616
1300.1034587743.193616
1300.1088827743.193616
1300.11437743.193616
1300.1197247743.193616
1300.1251487743.193616
1300.1305727743.193616
1300.1359967743.193616
1300.141427743.193616
1300.1468447743.193616
1300.1522687743.193616
1300.1576927743.193616
1300.1631167743.193616
1300.168547743.193616
1300.1739587743.193616
1300.1793827743.193616
1300.1848067743.193616
1300.190237743.193616
1300.1956547743.193616
1300.2010787743.193616
1300.2065027743.193616
1300.2119267743.193616
1300.217357743.193616
1300.2227747743.193616
1300.2281987743.193616
1300.2336167743.193616
1300.239047743.193616
1300.2444647743.193616
1300.2498887743.193616
1300.2553127743.193616
1300.2607367743.193616
1300.266167743.193616
1300.2715847743.193616
1300.2770087743.193616
1300.2824327743.193616
1300.2878567743.193616
1300.2932747743.193616
1300.2986987743.193616
1300.3041227743.193616
1300.3095467743.193616
1300.314977743.193616
1300.3203947743.193616
1300.3258187743.193616
1300.3312427743.193616
1300.3366667743.193616
1300.342097743.193616
1300.3475147743.193616
1300.3529327743.193616
1300.3583567743.193616
1300.363787743.193616
1300.3692047743.193616
1300.3746287743.193616
1300.3800527743.193616
1300.3854767743.193616
1300.39097743.193616
1300.3963247743.193616
1300.4017487743.193616
1300.4071727743.193616
1300.4125967743.193616
1300.418027743.193616
1300.4234447743.193616
1300.4288687743.193616
1300.4342927743.193616
1300.439717743.193616
1300.4451347743.193616
1300.4505587743.193616
1300.4559827743.193616
1300.4614067743.193616
1300.466837743.193616
1300.4722547743.193616
1300.4776787743.193616
1300.4831027743.193616
1300.4885267743.193616
1300.493957743.193616
1300.4993687743.193616
1300.5047927743.193616
1300.5102167743.193616
1300.515647743.193616
1300.5210647743.193616
1300.5264887743.193616
1300.5319127743.193616
1300.5373367743.193616
1300.542767743.193616
1300.5481847743.193616
1300.5536087743.193616
1300.5590267743.193616
1300.564457743.193616
1300.5698747743.193616
1300.5752987743.193616
1300.5807227743.193616
1300.5861467743.193616
1300.591577743.193616
1300.5969947743.193616
1300.6024187743.193616
1300.6078427743.193616
1300.6132667743.193616
1300.6186847743.193616
1300.6241087743.193616
1300.6295327743.193616
1300.6349567743.193616
1300.640387743.193616
1300.6458047743.193616
1300.6512287743.193616
1300.6566527743.193616
1300.6620767743.193616
1300.66757743.193616
1300.6729247743.193616
1300.6783427743.193616
1300.6837667743.193616
1300.689197743.193616
1300.6946147743.193616
1300.7000387743.193616
1300.7054627743.193616
1300.7108867743.193616
1300.716317743.193616
1300.7217347743.193616
1300.7271587743.193616
1300.7325827743.193616
1300.7380067743.193616
1300.743437743.193616
1300.7488547743.193616
1300.7542787743.193616
1300.7597027743.193616
1300.765127743.193616
1300.7705447743.193616
1300.7759687743.193616
1300.7813927743.193616
1300.7868167743.193616
1300.792247743.193616
1300.7976647743.193616
1300.8030887743.193616
1300.8085127743.193616
1300.8139367743.193616
1300.819367743.193616
1300.8247787743.193616
1300.8302027743.193616
1300.8356267743.193616
1300.841057743.193616
1300.8464747743.193616
1300.8518987743.193616
1300.8573227743.193616
1300.8627467743.193616
1300.868177743.193616
1300.8735947743.193616
1300.8790187743.193616
1300.8844367743.193616
1300.889867743.193616
1300.8952847743.193616
1300.9007087743.193616
1300.9061327743.193616
1300.9115567743.193616
1300.916987743.193616
1300.9224047743.193616
1300.9278287743.193616
1300.9332527743.193616
1300.9386767743.193616
1300.9440947743.193616
1300.9495187743.193616
1300.9549427743.193616
1300.9603667743.193616
1300.965797743.193616
1300.9712147743.193616
1300.9766387743.193616
1300.9820627743.193616
1300.9874867743.193616
1300.992917743.193616
1300.9983347743.193616
1301.0037527743.193616
1301.0091767743.193616
1301.01467743.193616
1301.0200247743.193616
1301.0254487743.193616
1301.0308727743.193616
1301.0362967743.193616
1301.041727743.193616
1301.0471447743.193616
1301.0525687743.193616
1301.0579927743.193616
1301.0634167743.193616
1301.068847743.193616
1301.0742647743.193616
1301.0796887743.193616
1301.0851127743.193616
1301.090537743.193616
1301.0959547743.193616
1301.1013787743.193616
1301.1068027743.193616
1301.1122267743.193616
1301.117657743.193616
1301.1230747743.193616
1301.1284987743.193616
1301.1339227743.193616
1301.1393467743.193616
1301.144777743.193616
1301.1501887743.193616
1301.1556127743.193616
1301.1610367743.193616
1301.166467743.193616
1301.1718847743.193616
1301.1773087743.193616
1301.1827327743.193616
1301.1881567743.193616
1301.193587743.193616
1301.1990047743.193616
1301.2044287743.193616
1301.2098467743.193616
1301.215277743.193616
1301.2206947743.193616
1301.2261187743.193616
1301.2315427743.193616
1301.2369667743.193616
1301.242397743.193616
1301.2478147743.193616
1301.2532387743.193616
1301.2586627743.193616
1301.2640867743.193616
1301.2695047743.193616
1301.2749287743.193616
1301.2803527743.193616
1301.2857767743.193616
1301.29127743.193616
1301.2966247743.193616
1301.3020487743.193616
1301.3074727743.193616
1301.3128967743.193616
1301.318327743.193616
1301.3237447743.193616
1301.3291627743.193616
1301.3345867743.193616
1301.340017743.193616
1301.3454347743.193616
1301.3508587743.193616
1301.3562827743.193616
1301.3617067743.193616
1301.367137743.193616
1301.3725547743.193616
1301.3779787743.193616
1301.3834027743.193616

<colgroup><col><col></colgroup><tbody>
</tbody>

This is the final piece of SW i need to make my simulator complete.

Thanks
Aniket
 
Upvote 0
Try this. I assumed that was Column A and B. Change as necessary

Code:
Sub SaveINIfile()
Dim x, r As Long
x = Application.GetSaveAsFilename(fileFilter:="INI Files (*.ini), *.ini")
If x = False Then Exit Sub
Open x For Output As [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] 
Print [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , "[GPS Coords]"
For r = 2 To Range("A" & Rows.Count).End(xlUp).Row
    Print [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] , "Coord" & r - 1 & "=" & Cells(r, "A") & "," & Cells(r, "B")
Next
Close [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL] 
End Sub
 
Upvote 0
Try this. I assumed that was Column A and B. Change as necessary

Code:
Sub SaveINIfile()
Dim x, r As Long
x = Application.GetSaveAsFilename(fileFilter:="INI Files (*.ini), *.ini")
If x = False Then Exit Sub
Open x For Output As [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] 
Print [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , "[GPS Coords]"
For r = 2 To Range("A" & Rows.Count).End(xlUp).Row
    Print [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , "Coord" & r - 1 & "=" & Cells(r, "A") & "," & Cells(r, "B")
Next
Close [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] 
End Sub


Thanks a lot Scott, it works like a charm.
I integrated my D.d to DM.m macro conversion with yours, and result was as per my expectation.

Thanks again.
Aniket
 
Upvote 0

Forum statistics

Threads
1,215,547
Messages
6,125,461
Members
449,228
Latest member
moaz_cma

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top