In Excel, we can apply the strikethrough to remove the unwanted cell contents manually, but, in this article, I will talk about how to auto strikethrough based on cell value. Solved this problem.How to auto strikethrough based on cell value in Excel? everything else i posted the first time is still the same. as always, any help with this issue would be greatly appreciated. Sorry for all the questions, it's just a little frustrating.
Should i be including a different namespace for excel? doesn't there have to be some namespace that works within excel 2007 (since the macro code works) that would provide the same functionality if included in a VB2008 app? do these change within different versions of excel? so, if i'm including the excel namespace in my VB app, why wouldn't all of the sameĬode work? and why did adding the "nstants." prefix help on some values, but not others?Īlso, how would i know what the values of some of the enums need to be set to? i was counting on the macro code to provide the functionality that i did manually, programmatically with code. i copied the code directly from the excel 2007 macro that executed. Maybe i'm a little clueless, but i guess i don't get the microsoft programming concept yet. "public member 'selection' on type 'worksheet' not found. however, i get a MISSINGMEMBEREXCEPTION when it runs. when i did, my app does open up my test spreadsheet. i commented out the ones that are still undefined, so i could at least try to run the program. by adding the prefix for the namespace(?) "nstants." there are still 2 values that do not compile though, and i'm not sure why.
i did what you suggested and it has improved the compile issues. Solved this problem. There is a good discussion here: For the other error you can search on the exact error text and find where other people hae To solve that error you need to consult the documentation for the object that the error refers to, and determine why your reference to the member is invalid. Your MISSINGMEMBEREXCEPTION is described here: I would expect that an enumerated constant of None is zero. For a good description of using the Excel object model from VS, see:įor the remaining enumerated constants you can experiment with integer values until you get the effect you want. Is the same, so there are a lot of similiarities that you can take advantage of. However, the underlying model that they are using
There's no reason to expect that your access to the Excel object model using VS and VB will be the same as your access using the built-in scripting language of Excel, as they are different applications. Most of hte compile issues involve items as being "not declared", such as ObjXLBook.SaveAs("P:\temp\CBS-Book1.xlsX") Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickĭim objXL As .Applicationĭim objXLBook As .Workbookĭim objXLSheet As .Worksheet Being somewhat new to this process, i'm not sure how to correc the macro code to get a good compile that does what i need it to do. when i post the macro code into my VB procedure, i get errors because some of the excel-specific commands do not directly translate to my implementation I am writing a VB 2008 Express application that opens up a spreadsheet and makes changes to it. I recorded the following macro in excel 2007: