Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


eme



102 posts

Master Geek
+1 received by user: 5


Topic # 173528 26-May-2015 17:25
Send private message

I'd like to come to grips with Visual Studio by migrating some of my Excel VB Scripts to it.
Anyone have recommendations to make a start.
I am familiar with the "Hello World" type examples.

Create new topic
4 posts

Wannabe Geek


  Reply # 1318326 6-Jun-2015 16:32
Send private message

Hmm.. I built a program which will automatically extra VBA macros from spreadsheets and convert them into VB.net classes. Although since I did this as work it'll be company IP so can't really distribute it.

But it should be pretty straightforward to create an empty new vb.net class in visual studio, and then copy and paste the VBA macro into it. Visual studio will highlight any compilations errors to fix up.

eme



102 posts

Master Geek
+1 received by user: 5


  Reply # 1318399 6-Jun-2015 18:34
Send private message

Thanks Alagalact, that should be instructive.
Are you suggesting I copy the whole contents of a module to a VS VB Class?

 
 
 
 


4 posts

Wannabe Geek


  Reply # 1318458 6-Jun-2015 21:52
Send private message

Yeah pretty much. I guess it really depends upon what you're wanting to do.

If you're wanting to manipulate the excel workbook, then you'll want to use the excel interop library.
See this link for a quick example of manipulating a workbook via the interop: http://www.dotnetperls.com/excel-vbnet

If you don't need to directly access the workbook then you won't need to use the interop library. Quite a few of the functions
have changed between vb.net, and VBA used in Excel but microsoft has provided a compatibility library if you don't want to
refactor the code. It's all under the Microsoft.VisualBasic.Compatibility.VB6 namespace, although I believe there a dll you'll need
to add a reference too.

eme



102 posts

Master Geek
+1 received by user: 5


  Reply # 1318463 6-Jun-2015 22:12
Send private message

Thanks for the tips, I'll have a go with the compatability name space reference switched on , Hopefuly it's not to far from runable. I have a tricky function that gets a cell from a closed workbook, I'll see how the compatability gets on with that.

Create new topic



Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Orcon announces new always-on internet service for Small Business
Posted 18-Apr-2019 10:19


Spark Sport prices for Rugby World Cup 2019 announced
Posted 16-Apr-2019 07:58


2degrees launches new unlimited mobile plan
Posted 15-Apr-2019 09:35


Redgate brings together major industry speakers for SQL in the City Summits
Posted 13-Apr-2019 12:35


Exported honey authenticated on Blockchain
Posted 10-Apr-2019 21:19


HPE and Nutanix partner to deliver hybrid cloud as a service
Posted 10-Apr-2019 21:12


Southern Cross and ASN sign contract for Southern Cross NEXT
Posted 10-Apr-2019 21:09


Data security top New Zealand consumer priority when choosing a bank
Posted 10-Apr-2019 21:07


Samsung announces first 8K screens to hit New Zealand
Posted 10-Apr-2019 21:03


New cyber-protection and insurance product for businesses launched in APAC
Posted 10-Apr-2019 20:59


Kiwis ensure streaming is never interrupted by opting for uncapped broadband plans
Posted 7-Apr-2019 09:05


DHL Express introduces new MyDHL+ online portal to make shipping easier
Posted 7-Apr-2019 08:51


RackWare hybrid cloud platform removes barriers to enterprise cloud adoption
Posted 7-Apr-2019 08:50


Top partner named at MYOB High Achievers Awards
Posted 7-Apr-2019 08:48


Great ideas start in Gisborne with hackathon event back for another round
Posted 7-Apr-2019 08:42



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.