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.
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.
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.
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.
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.