GreenCan Posted March 10, 2009 Share Posted March 10, 2009 (edited) Hi Excel geeks,Has anyone experience with Excel's LockAspectRatio in AutoIt?I want to add a logo in the title row (row 1) of an Excel spreadsheet, resize it automatically to the height of row 1 and (of course) keep the ratio of the image intact without having to bother about the original sizes of the image.I found the property on MSDN ( http://msdn.microsoft.com/en-us/library/aa...office.11).aspx ) but I don't know how to set the MsoTriState in Autoit.corrected code:#include <ExcelCOM_UDF.au3> ; for the purpose of _ExcelRowHeightSet only Local $Title_Height = 50 ; pixel size as example _ExcelRowHeightSet($oExcel, 1, $Title_Height) Local $Image_Name = "c:\picture.gif" Local $Left = 500 Local $Top = 0 $oExcel.ActiveSheet.Pictures.Insert($Image_Name).Select $oExcel.ActiveSheet.Shapes("Picture 1").Select With $oExcel.Selection.ShapeRange .Left = $Left .Top = $Top .LockAspectRatio = -1 ; will keep the picture aspect ratio while resizing it .Height = $Title_Height ; automatically resized to Title height EndWithYour help very much appreciated.ThanksGreencan Edited March 10, 2009 by GreenCan Contributions CheckUpdate - SelfUpdating script ------- Self updating script Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple MsgBox with CountDown ------------------- MsgBox with visual countdown Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV) USB Drive Tools ------------------------------ Tool to help you with your USB drive management Input Period udf ------------------------------ GUI for a period input Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette Excel Chart UDF ----------------------------- Collaboration project with water GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm TaskListAllDetailed --------------------------- List All Scheduled Tasks Computer Info --------------------------------- A collection of information for helpdesk Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only) Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane Oracle SQL Report Generator ------------- Oracle Report generator using SQL SQLite Report Generator ------------------- SQLite Report generator using SQL SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access Animated animals ----------------------------- Fun: Moving animated objects Perforated image in GUI --------------------- Fun: Perforate your image with image objects UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool Visual Image effect (GUI) -------------------- Visually apply effects on an image Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 10, 2009 Share Posted March 10, 2009 (edited) Hi Excel geeks, Has anyone experience with Excel's LockAspectRatio in AutoIt? I want to add a logo in the title row (row 1) of an Excel spreadsheet, resize it automatically to the height of row 1 and (of course) keep the ratio of the image intact without having to bother about the original sizes of the image. I found the property on MSDN ( http://msdn.microsoft.com/en-us/library/aa...office.11).aspx ) but I don't know how to set the MsoTriState in Autoit. #include <ExcelCOM_UDF.au3>; for the purpose of _ExcelRowHeightSet only Local $Title_Height = 50; pixel size as example _ExcelRowHeightSet($oExcel, 1, $Title_Height) Local $Image_Name = "c:\picture.gif" Local $Left = 500 Local $Top = 0 $oExcel.ActiveSheet.Pictures.Insert($Image_Name).Select $oExcel.ActiveSheet.Shapes("Picture 1").Select With $oExcel.Selection.ShapeRange .Left = $Left .Top = $Top .LockAspectRatio = msoTrue; This doesn't work !!! .Height = $Title_Height; automatically resized to Title height EndWith Your help very much appreciated. Thanks Greencan Try the following to see what works in that context: .LockAspectRatio = msoTrue ; This doesn't work !!! .LockAspectRatio = True ; Or .LockAspectRatio = -1 ; Or .LockAspectRatio = 1 I'm betting on -1 working, and maybe the native AutoIt "True" keyword. Edit: Fixed code tags Edited March 10, 2009 by PsaltyDS footswitch 1 Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
GreenCan Posted March 10, 2009 Author Share Posted March 10, 2009 Hi PsaltyDS, I tried already .LockAspectRatio = True COM Error ! err.description is: The specified value is out of range. err.windescription: The parameter is incorrect. err.number is: 80020009 but not .LockAspectRatio = -1 You are soo smart I wish I could be smart too Thank you very much Greencan Contributions CheckUpdate - SelfUpdating script ------- Self updating script Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple MsgBox with CountDown ------------------- MsgBox with visual countdown Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV) USB Drive Tools ------------------------------ Tool to help you with your USB drive management Input Period udf ------------------------------ GUI for a period input Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette Excel Chart UDF ----------------------------- Collaboration project with water GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm TaskListAllDetailed --------------------------- List All Scheduled Tasks Computer Info --------------------------------- A collection of information for helpdesk Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only) Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane Oracle SQL Report Generator ------------- Oracle Report generator using SQL SQLite Report Generator ------------------- SQLite Report generator using SQL SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access Animated animals ----------------------------- Fun: Moving animated objects Perforated image in GUI --------------------- Fun: Perforate your image with image objects UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool Visual Image effect (GUI) -------------------- Visually apply effects on an image Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now