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


# 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


  # 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


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

D Link ANZ launches EXO Smart Mesh Wi Fi Routers with McAfee protection
Posted 15-Oct-2019 11:31


Major Japanese retailer partners with smart New Zealand technology IMAGR
Posted 14-Oct-2019 10:29


Ola pioneers one-time passcode feature to fight rideshare fraud
Posted 14-Oct-2019 10:24


Spark Sport new home of NZC matches from 2020
Posted 10-Oct-2019 09:59


Meet Nola, Noel Leeming's new digital employee
Posted 4-Oct-2019 08:07


Registrations for Sprout Accelerator open for 2020 season
Posted 4-Oct-2019 08:02


Teletrac Navman welcomes AI tech leader Jens Meggers as new President
Posted 4-Oct-2019 07:41


Vodafone makes voice of 4G (VoLTE) official
Posted 4-Oct-2019 07:36


2degrees Reaches Milestone of 100,000 Broadband Customers
Posted 1-Oct-2019 09:17


Nokia 1 Plus available in New Zealand from 2nd October
Posted 30-Sep-2019 17:46


Ola integrates Apple Pay as payment method in New Zealand
Posted 25-Sep-2019 09:51


Facebook Portal to land in New Zealand
Posted 19-Sep-2019 18:35


Amazon Studios announces New Zealand as location for its upcoming series based on The Lord of the Rings
Posted 18-Sep-2019 17:24


The Warehouse chooses Elasticsearch service
Posted 18-Sep-2019 13:55


Voyager upgrades core network to 100Gbit
Posted 18-Sep-2019 13:52



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.