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


# 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


  # 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


  # 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


  # 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


  # 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 and LinkedIn »



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 »

Xero announces new smarter tools, push into the North American market
Posted 19-Jun-2019 17:20


New report by Unisys shows New Zealanders want action by social platform companies and police to monitor social media sites
Posted 19-Jun-2019 17:09


ASB adds Google Pay option to contactless payments
Posted 19-Jun-2019 17:05


New Zealand PC Market declines on the back of high channel inventory, IDC reports
Posted 18-Jun-2019 17:35


Air New Zealand uses drones to inspect aircraft
Posted 17-Jun-2019 15:39


TCL Electronics launches its first-ever 8K TV
Posted 17-Jun-2019 15:18


E-scooter share scheme launches in Wellington
Posted 17-Jun-2019 12:34


Anyone can broadcast with Kordia Pop Up TV
Posted 13-Jun-2019 10:51


Volvo and Uber present production vehicle ready for self-driving
Posted 13-Jun-2019 10:47


100,000 customers connected to fibre broadband network through Enable
Posted 13-Jun-2019 10:35


5G uptake even faster than expected
Posted 12-Jun-2019 10:01


Xbox showcases 60 anticipated games
Posted 10-Jun-2019 20:24


Trend Micro Turns Public Hotspots into Secure Networks with WiFi Protection for Mobile Devices
Posted 5-Jun-2019 13:24


Bold UK spinoff for beauty software company Flossie
Posted 2-Jun-2019 14:10


Amazon Introduces Echo Show 5
Posted 1-Jun-2019 15:32



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.