|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Where is ThisWorkbook.Sheets("xx") ?? Unable to resolve 'ThisWorkbook' :: Interop to ExcelI am converting an EXCEL VBA application to Visual Basic (2003).
I am not having much luck finding how to convert statements containing references to things like ThisWorkbook.Sheets("sheetname"). I am not using Visual Studio Tools (which may be my problem, tho I would think that I don't really need the templates --- or do I??) Eric (Soory for the repost - I noticed a typo in my Subject) "Eric W" <nob***@wzone.com> wrote in message Have you tried recording macros and seeing what the code looks like?news:pan.2006.03.14.23.51.25.384915@wzone.com... >I am converting an EXCEL VBA application to Visual Basic (2003). > > I am not having much luck finding how to convert statements containing > references to things like ThisWorkbook.Sheets("sheetname"). > > I am not using Visual Studio Tools (which may be my problem, tho I would > think that I don't really need the templates --- or do I??) ThisWorkBook can be used inside VBA because it is an intrinsic object, but
from outside you need to retrieve the WorkBook from the Application instance, usingh objApplication.ActiveWorkbook or objApplication.WorkBooks.Item(xxx) Which is your specific problem? -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com "Eric W" <nob***@wzone.com> escribió en el mensaje news:pan.2006.03.14.23.51.25.384915@wzone.com... >I am converting an EXCEL VBA application to Visual Basic (2003). > > I am not having much luck finding how to convert statements containing > references to things like ThisWorkbook.Sheets("sheetname"). > > I am not using Visual Studio Tools (which may be my problem, tho I would > think that I don't really need the templates --- or do I??) > > Eric > > > (Soory for the repost - I noticed a typo in my Subject) In my Basic.Net code, I figured out that I can resolve the Application
references with the statements: Dim ExcelWorkbook = Excel.Workbook Dim ExcelWorksheet = Excel.ApplicationClass That made the syntax errors go away. BUT if I try to do something really simple like MsgBox(Application.Cells("A1") I get an #Value! error in Excel. Which when I think about it, I'm not assigning ExcelWorkbook nor ExcelWorksheet to anything, so it's no wonder why I get an error. So....... How do I reference to actual Excel Object? (So that I can refer to cells, ranges, and use Excel's functions.) (My code didn't start Excel; Excel called me). I don't have the Visual Studio Tools for Office (maybe I should buy it???) On Wed, 15 Mar 2006 12:32:39 +0100, Carlos J. Quintero [VB MVP] wrote: Show quoteHide quote > ThisWorkBook can be used inside VBA because it is an intrinsic object, but > from outside you need to retrieve the WorkBook from the Application > instance, usingh objApplication.ActiveWorkbook or > objApplication.WorkBooks.Item(xxx) > > Which is your specific problem? Hi,
> (My code didn't start Excel; Excel called me). AFAIK, there are three ways to interact with Excel:> I don't have the Visual Studio Tools for Office (maybe I should buy it???) - Your code starts Excel externally - You are creating an add-in for Excel using .NET. - You are using VSTO to extend Excel instead of using VBA. So, which is your case? How does Excel "call" you? -- Best regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com
I miss loop
length of string Adding Button Programatically - have an answer??? Visual Studio 2003 Menu on form.vb Sub Main is not waiting!!!?? Adding data to database XmlDocument object to string - plase help with unusual character! best way to tell if a date is not assigned? Visual Basic .NET Resource Kit Form Size |
|||||||||||||||||||||||