New topic: 

Is this a bug or I lack of experience? (Excel - RB)

<http://forums.realsoftware.com/viewtopic.php?t=47666>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        Luis          Post subject: Is this a bug or I lack of 
experience? (Excel - RB)Posted: Sun Apr 21, 2013 6:57 pm                        
 
Joined: Wed Oct 08, 2008 6:55 pm
Posts: 17
Location: Eden Prairie, MN, USA                Hello,
Till last Friday, the following code was working great. No crashes, excellent 
performance.
dim excel As new ExcelApplication
dim book As ExcelWorkbook
dim sheet As ExcelWorksheet

'=======Add New Workbook=========
book=excel.workbooks.add

'======Risk Input Worksheet=============
excel.worksheets(1).name="Input"
excel.worksheets(1).Range ("A1").value="ID"              'Risk ID number, 
numeric
excel.worksheets(1).Range("A1").Select_
excel.worksheets(1).Range("A1").Addcomment
excel.worksheets(1).Range("A1").Comment.Text ("pippo")
excel.worksheets(1).Range("A1").Comment.Visible = False
excel.worksheets(1).Range("A2").Select_
excel.worksheets(1).Range("A2").Addcomment
excel.worksheets(1).Range("A2").Comment.Text ("Alberto")
excel.worksheets(1).Range("A2").Comment.Visible = False

excel.visible = true // Show the excel application

excel = Nil //Set the object to Nil
Exception err as OLEException // Check for an error
MsgBox err.message  // Display the error


Now, the only way I am able to see the "ID", "Comments", etc, after Excel opens 
is by moving the "excel.visible=True" up after "book=excel.workbooks.add". 
(Why?)

If I run the code as shown, Excel opens but that is all. No text in cell or 
comments. 
If I move the "visible..." property up, it works. 

For a few months I have been working in an application where the "visible" 
property was always placed as shown and had no problem at all. I based all my 
code after reading the excellent book from Mr. Eugene Dakin "Program Excel 2010 
with REALStudio in Windows".

I did updated RB to the current revision 2012r2.1 last March, but it was 
working great since then till last week and no other changes or upgrades took 
place in my machine. 

Is this a bug? Have anyone experienced this before? Why I need to change the 
location of a line of code to make it work, while it was working for many 
months when placed at the end of the code as shown? Am I missing anything?

The reason I placed the "visible.." property at the end is to gain efficiency 
by only presenting the open worksheet after it was all configured at once. 

Thank you in advance for any input.
Luis.   
                             Top                eugenedakin          Post 
subject: Re: Is this a bug or I lack of experience? (Excel - RB)Posted: Sun Apr 
28, 2013 10:17 pm                         
Joined: Mon Jan 02, 2006 11:43 am
Posts: 162
Location: Calgary, Alberta, Canada                Hello Luis, 

Hmmm.. I don't know what to say about the code. I copied your code and ran it 
on my Windows 8 machine with Real Software 2012 r2.1 and Office 2010 and it 
worked great!

If a restart of the computer does not change anything, then my only guess would 
be to possibly run 'Wise Registry Cleaner' (its free) to clean up the windows 
registry (make sure you do a backup first). Every once in a while I get an 
error and a reboot usually works. The reasons for this vary, and sometimes its 
Real Studio related, an update from Microsoft for the OS, or an update in 
Excel. Usually a reboot works because 'hot' updates are placed in the OS, and 
the reboot causes the changes to be more permanent. Although Microsoft says 
that a reboot is not required, it is still a good idea. 

Let me know if you have any other thoughts. Happy to help, 

Eugene   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to