tag:blogger.com,1999:blog-284600789737488130.post1661201160190579596..comments2024-02-07T02:22:20.642-05:00Comments on Ruby on Windows: Working with Win32OLE ConstantsDavid Mullethttp://www.blogger.com/profile/05597492688893461137noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-284600789737488130.post-13797455520520894422008-10-21T04:51:00.000-05:002008-10-21T04:51:00.000-05:00Thanks David,I'll try your tip. Another related in...Thanks David,<BR/><BR/>I'll try your tip. Another related information that took a long time googling (since I did not know what to look for) was Application.AutomationSecurity. It has 3 values (ByUI, ForceDisable, Low). I wanted to parse over 6500 XLS files but some of those had auto Macros that triggered dialog boxes (error or otherwise) that needed user interaction. Some went away with DisplayAlerts. But some persisted even when I put Maximum Security for Macros in Excel. Setting this property seems to have solved the problem. I will try to set the macro security to Low in the UI and then see if the Ruby code overrides it or not.Unknownhttps://www.blogger.com/profile/09561701597825876030noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-41627731728770093142008-10-16T06:54:00.000-05:002008-10-16T06:54:00.000-05:00@faiz-Be sure to fully qualify your constant with ...@faiz-<BR/><BR/>Be sure to fully qualify your constant with the namespace:<BR/><BR/>ExcelConst::XlCalculationManual <BR/><BR/>The following code runs for me:<BR/><BR/>-----<BR/>require 'win32ole'<BR/><BR/>class ExcelConst<BR/>end<BR/><BR/>excel = WIN32OLE.new('Excel.Application')<BR/>WIN32OLE.const_load(excel, ExcelConst)<BR/>excel.Visible = true<BR/>wb = excel.Workbooks.Add<BR/>puts excel.Calculation # outputs -4105<BR/>excel.Calculation = ExcelConst::XlCalculationManual <BR/>puts excel.Calculation # outputs -4135<BR/>-----<BR/><BR/>If you still have problems with this, send me your code and I'll take a look at it.<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-36809327393746360762008-10-16T02:51:00.000-05:002008-10-16T02:51:00.000-05:00Thanks for the clear step-by-step. However I was n...Thanks for the clear step-by-step. However I was not able to say: Application.Calculation = XlCalculationManual <BR/><BR/>using this procedure. Even though the proper constant was returned (-4135) the assignment statement in Ruby gave an error. I ended up using <BR/><BR/>ScreenUpdating = false <BR/><BR/>and <BR/><BR/>EnableCalculation = false <BR/><BR/>instead. Any ideas?Unknownhttps://www.blogger.com/profile/09561701597825876030noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-9511026041879891362008-08-31T09:06:00.000-05:002008-08-31T09:06:00.000-05:00@john:I have just posted a new article on Automati...@john:<BR/><BR/>I have just posted a new article on <A HREF="http://rubyonwindows.blogspot.com/2008/08/automating-powerpoint-with-ruby.html" REL="nofollow">Automating PowerPoint with Ruby</A>.<BR/><BR/>I'll post more in a later article, but this will hopefully get you started.<BR/><BR/>Thanks for the suggestion!<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-36897076295939135332008-08-27T18:34:00.000-05:002008-08-27T18:34:00.000-05:00Do you have any examples of how to generate Powerp...Do you have any examples of how to generate Powerpoint presentations with Ruby? I can't seem to get past the step on adding a new slide.Johnhttps://www.blogger.com/profile/06241817356318669101noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-44084782451198565362008-07-06T23:12:00.000-05:002008-07-06T23:12:00.000-05:00Truly a time-saving tip. Thank you.Another referen...Truly a time-saving tip. Thank you.<BR/><BR/>Another reference for constants (albeit old, for Office 97) was this official download:<BR/>http://support.microsoft.com/kb/q112671/<BR/><BR/>It was good for Ruby use because the constants were copied to a text file.piyohttps://www.blogger.com/profile/16255445653576846162noreply@blogger.com