Home |
Search |
Today's Posts |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
From what I have learned, in your example below, looks as though the "ws"
variable is a "Worksheet Collection" (may be declared as "ws As Excel.Worksheets", and you are attempting to set it to a "Worksheet Object", thus probably why it's not working. However, when you do the "GetSheets" function, it resets the ws back to the proper collection. I'm also assuming you are declaring your variables. If you set a variable to a "Worksheet Object" such as the following VBA declaration command: Dim wsh As Excel.Worksheet 'Note, there is no "s" as the end to refer to the object rather than the collection. then what looks to be like your C++ command. wsh = ws.Add( vOpt, vOpt, COleVariant((short)3), COleVariant((short)XL_WORKSHEET) ); This way you don't get a "Mistype" error. Glad to be of help to the extent possible. I have worked with Excel VBA quite extensively and I'm also in the process of getting my MCSD cert dealing with .NET programming. There's one main thing about the .NET programming that I don't like about it, and it's the fact that it has gotten away from using the Goto feature. I most certainly understand their argument for it, but there are those rare occassions for it's use outside of error catching. If anything, I generally use it more so for debugging and error catching purposes than for anything else, but yet, there's those rare exceptions to that rule. -- Sincerely, Ronald R. Dodge, Jr. Master MOUS 2000 "Kevin" wrote in message oups.com... Hey Ronal thanks for your suggestions, in one way or another it helped me find the problem... here is the solution... very weird how It came about. //Setting the result to ws for some reason ws wont work again, but ws = ws.Add( vOpt, vOpt, COleVariant((short)3), COleVariant((short)XL_WORKSHEET) ); //Setting this right after to re gain the objects properties for ws no it works! ws = _wb.GetSheets(); thanks all PROBLEM SOLVED! -Kevin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel window closed but process still running | Excel Programming | |||
Excel.Application.Quit leaving Excel process stays active | Excel Programming | |||
How to Kill Excel application process | Excel Programming | |||
Providing Estimate to Complete Info on a Process | Excel Programming | |||
Mail merge issue - ghost Excel process remains after closing application | Excel Programming |