vb.net - Translation program from VBA to vb NET -


generally have working program macro in excel , wanted extract 1 button simple windows application. there simple way or better try recognize differences between vba , vb.net , try write scratch?

sub zapisywanie_txt_biesse_wr()      dim textfile integer     dim filepath string     dim filecontent string, strcontent() string     dim newname string     dim strfile string     dim filenum string     dim last_dot long     dim posstart integer     dim poslength integer     dim integer     dim j integer     dim lpx integer     dim mytxtfile      on error goto errorhandle      'zmienic domyslna lokacje na lokacje aplikacji     'chdir "c:\users\marcin.perz\desktop\makro zmieniajace pliki"     chdir activeworkbook.path      'spytac sie o plik przerobienia     filepath = application.getopenfilename("text files (*.txt),*.txt")      'nastepny wolny numer dla txt     textfile = freefile      'otworzenie txt w trybie odczytu     open filepath input textfile      'zapisanie zawartosci pliku pamieci     filecontent = input(lof(textfile), textfile)      'zamkniecie pliku     close textfile      'znajdz/zamien prcedury     filecontent = replace(filecontent, "campod0=labl,a,4,4,null,0,0", "campod0=labl,a,4,4,null,0,0")     filecontent = replace(filecontent, "campod1=prog,a,256,8,null,0,2", "campod1=prog,a,256,8,null,0,2")     filecontent = replace(filecontent, "campod2=qnta,u,4,4,null,0,0", "campod2=qnta,u,4,4,null,0,0")     filecontent = replace(filecontent, "campod3=cont,u,4,4,null,0,0", "campod3=cont,u,4,4,null,0,0")     filecontent = replace(filecontent, "campod4=comm,a,768,80,null,0,0", "campod4=comm,a,768,80,null,0,0")     filecontent = replace(filecontent, "ordre", "$ ordre")     filecontent = replace(filecontent, "," & vbcrlf, " $, " & vbcrlf)      'nastepny wolny numer dla txt     textfile = freefile      'nadanie nowej nazwy lokazcji     last_dot = instrrev(filepath, ".")     newname = left$(filepath, last_dot - 1) & "_rover35" & mid$(filepath, last_dot)     filepath = newname      'otworzenie txt w trybie zapisu     open filepath output textfile      'zapisanie zmienionej zawartosci pliku     print #textfile, filecontent      'zakmniecie pliku     close textfile      '~~> podzielenie pliku na linie binarnie     open filepath binary #1     filecontent = space$(lof(1))     #1, , filecontent     close #1     strcontent() = split(filecontent, vbcrlf)      ' here conditional replecments split text array lines etc.      'polaczenie pliku     filecontent = join(strcontent, vbcrlf)      'otworzenie txt w trybie zapisu     open filepath output textfile      'zapisanie zmienionej zawartosci pliku     print #textfile, filecontent      'zakmniecie pliku     close textfile      mytxtfile = shell("c:\windows\notepad.exe " & filepath, 1)      'etykieta wyjscia z programu beforeexit:     'wyjscie z programu     exit sub     'etykieta radzenia sobie z bledami errorhandle:     msgbox err.description     'skierowanie wyjscia z programu     resume beforeexit     'koniec makra end sub 

you try 1 of following:

  1. copy code vb.net windows form , correct errors go
  2. install vb6 , paste code project (since vba vb6 code). attempt open vb6 project in vb.net, @ point it'll perform upgrade process you

good luck.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -