Jump to content

Search the Community

Showing results for tags 'Excel'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 208 results

  1. Currently, I'm working on a program that will display Dialog boxes with either Yes or No. For each dialog, I reward the user with X amount of Credits. I'm hoping to output the amount of credits to a cell in a column (there will be 20 different columns). It will only post to a row that is equal to today's date (first column). If no row exists yet with the current date, it will start a new row. Any suggestions? Thank you
  2. How do I properly convert this to Autoit? This is a VBA macro that I recorded in Excel.  ActiveSheet.Outline.ShowLevels RowLevels:=2 I need this to close my subtotal once it is finished. any help will be greatly appreciated.
  3. Hi All, While creating a few excel spreadsheets using AutoIt, I came across something which to my limiting time to research the forums I don't anyone has mentioned. The color pallettes are reversed. Huge shock to me. I wanted to produce a red row but kept on getting blue. Seems like 0xFF0000 was red on the charts but when running the script, I got blue. I then played around with the colors, and after a few tries, I finally got Red. Reversed the FF0000 and the result is 0000FF. So for Excel compared to Html 0000FF (Red) - Excel 0000FF (Blue) - Html FFFF00 (Cyan) - Excel FFFF00(Yellow) - Html
  4. Yesterday I had to make some little changes to an old Autoit program we use at my work. The program reads some data and convert it to Excel. Before writing the cell, it is changed to text and later on I slap the column with an autofitwidth. Furthermore weI execute a conditional format on the sheet, to make the data more readable. I quickly found out that because of the breaking changes Excel.udf had starting from AutoIt 3.3.12.0, a lot of things had to been changed. The changes I had to do, only took 10 minutes. After trying to adjust the script for over 5 hours, to get it working with the new Excel.udf, I gave up. I stopped changing the script, uninstalled the my Autoit and went looking for an older version. Luckilly I was able to find Autoit v3.3.8.1 (with corresponding Scite) in my software repository. Installing Autoit V3.3.8.1 and compiling the file, now took me 10 minutes . So why did I not get the old script working with the new Excel.udf? There are several reasons I failed getting the old script working with the new Excel UDF. I had some pressure from management to fix it ASAP (and got a little anxious) Most all resources on the internet point to the working of the old EXcel.UDF And offcourse there were thosing "breaking changes", with new functions using diffrent parameters or using parameters in different order. One of the column's on the sheet is used to store EAN13 (barcode) and was formatted like 1,23E12. I couldn't change the cell to text, also autofitwidt was not working and using conditional formatting was also a no-no. So in the end I could use the new Excel UDF, but not desapointed management. What would I like to ask? I understand that sometimes you want to rewrite a program to make it better. I even understand that one has to make breaking changes sometimes. But in this case because of lacking examples/resources my day went completely down the drain. I would like to ask the Excel.udf developpers to: Make more functions available to do things like changing cell properties easily, changing cell color, do an autofit columnwidth, format data conditionally. Or write an Example using the (new) Excel UDF, making examples how to format a cell, do conditional format, changing cell colors etc. I probably am more of an example guy. Having a good Excel.UDF Example showing a lot of common things normally makes, programming things easy for me. Because I can keep tweaking snippets until I get it working the way I want it. So dear developpers, could you help me and other future user out?
  5. Hello, Suddenly, I am getting an error (@extended = -2147221164) when I try to open excel using: #include <Excel.au3> _Excel_Open() If @error Then MsgBox(0,"",@error &@CRLF &@extended) Can anyone help with this?
  6. I want to check some Excel data against data on a website in Chrome. I use Chrome because the site I use does not function properly in Internet Explorer or Firefox. I know how to do the Excel stuff I just can not figure out how to send to Chrome, let alone check to see if the data matches or not. I am also having trouble finding any help online while searching for Chrome functions for Autoit. I have a Chrome UDF installed but I still can not figure out how to get my code to properly function. (I am not posting code because I am sure my code isn't right, to begin with) As usual, any and all help would be greatly appreciated.
  7. My program has to first search for names in Column D that do not match up with column C. I got that search to work using arrays. It was slow and I could not figure out how to delete them so I just manually put coded the names that do not belong. I found their cell location but I do not know how to store that location and delete it. This is what I have so far. Local $NameToDelete1[6]  = _Excel_RangeFind($OpenWorkbook, "Smith, Bill") _ArrayDisplay($NameToDelete1, "Excel UDF: _Excel_RangeFind Example 1", "", 0, "|", "Sheet|Name|Cell|Value|Formula|Comment") _Excel_RangeDelete($OpenWorkbook.ActiveSheet, $NameToDelete1[2], $xlShiftUp) Please help, I wanted to have this program done yesterday but I did not see this problem until yesterday.
  8. I need to perform a subtotal in excel and I would like to automate this process using Autoit if possible like always any and all help will be greatly appreciated. I can not find a good example but the two from Microsoft. Here is one of the two from msdn.microsoft.com/en-us/vba/excel-vba/articles/range-subtotal-method-excel I do not really understand how to translate this into AutoIt, but I gave it a try and here is what I have. $OpenRange      = "A1:E200" $xlSum          = -4157 $Added_Array[2] = [2, 3] $OpenRange.Subtotal("B1", $xlSum, $Added_Array, True, False, True) I just need to perform a subtotal on a range based on a header called department, and then perform a sum on the results.
  9. How to use _Excel_RangeSort to sort my excel file by three different headers Column A1, B1, and C1 have headers on which I want to sort by. The headers on which I want to sort are department, employee type, and name. I still really new to AutoIt so I do not actually know how to properly start this line or lines of code, to be honest. The example code is the best I can do. _Excel_RangeSort($OpenWorkbook, Default, "A1:C1", "1:1", $xlDescending, Default, $xlYes, Default, $xlSortRows) I just need to sort by those three headers in that order of department, employee type, and name, plus in descending order. any and all help would be greatly appreciated. Thank you!
  10. Excel format

    Good morning. I have a system I am trying to automate that works like this: user fills a column in an Excel spreadsheet with values they would like printed and saves it to a folder on their desktop, they start the script and it formats their data into a text file (adding a prefix) and sends the text file as a .bch file where it needs to go. This is working: #include <Array.au3> #include <Excel.au3> #include <File.au3> #include <MsgBoxConstants.au3> Global $sSTCArray Global $sFilename = @DesktopDir & "\Labels\print.txt" Global $sWorkbook = @DesktopDir & "\Labels\Labels.xlsx" Global $oExcel = _Excel_Open(False,False,False,False,True) barcodePrint() Func barcodePrint() $Read = _Excel_BookOpen($oExcel, $sWorkbook, True, False, Default, Default, Default) FileOpen($sFilename, $FO_OVERWRITE) ;Global $oWorkbook = _Excel_BookAttach($oExcel) Global $sSTCArray = _Excel_RangeRead($Read) For $i = 0 to UBound($sSTCArray, 1) - 1 FileWriteLine($sFilename, "!StaticShelving1x3_ZPL," & $sSTCArray[$i]) Next _Excel_Close($oExcel) FileMove($sFilename, "***file path***\print.bch") EndFunc However, it only works if the user first formats the spreadsheet to text. I want to automate that. From what I have read it appears AutoIt does not like formatting cells that already have values. True? Can I pull the values from an un-formatted (default GENERAL format) spreadsheet and go straight to my text file? I have also considered opening a second spreadsheet, formatting it, and copying the values over. Like this: Global $sPrefix Global $oPath Global $sSTCArray Global $sFilename = @DesktopDir & "\Labels\print.txt" Global $sWorkbook = @DesktopDir & "\Labels\Labels.xlsx" Global $oExcel = _Excel_Open(False,False,False,False,True) Global $aArray Global $bExcel _Excel_BookNew($bExcel) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $aArray = IniReadSection("***File path***\barcode.ini", "stc/rvt/mgm") $sPrefix = $aArray[1][1] $oPath = $aArray[2][1] barcodePrint() EndSwitch WEnd Func barcodePrint() $oWorkbook = _Excel_BookOpen($bExcel, @DesktopDir & "\Labels\print.xlsx") $oWorkbook.ActiveSheet.Columns("A").NumberFormat = "@" Local $Read = _Excel_BookOpen($oExcel, $sWorkbook, True, False, Default, Default, Default) $oCopy = _Excel_RangeRead($sWorkbook) _Excel_RangeWrite($oWorkbook, Default, $oCopy) FileOpen($sFilename, $FO_OVERWRITE) $sSTCArray = _Excel_RangeRead($Read,"Default","Default",3) ;_ArrayDisplay($sSTCArray) For $i = 0 to UBound($sSTCArray, 1) - 1 FileWriteLine($sFilename, $sPrefix & $sSTCArray[$i]) Next _Excel_Close($oExcel) ;FileMove($sFilename, $oPath) Exit EndFunc This does not like the formatting of $oWorkbook: "Variable must be of type 'Object'". Do I need this second sheet? If so, how can I format it? Is there a better way to get the Excel values into a .txt file? Any ideas would be appreciated. Thanks!
  11. It works fine on my Excel 2007, but after I Emailed My Area Manager he told me after he Enable Macro Security nothing happen's, can someone test this to run on Excel 2016? My AM can't provide me more information Thank You in Advance, Please see attachment. <snip>
  12. Hello, I am trying to keep only the filtered rows in an excel sheet but couldn't find a fast way to do it for a 1k+ rows file. Tried going through each row to see if it's hidden or not and if it is, delete it but it's not fast: Local $oExcel = _Excel_Open() Local $File = _Excel_BookOpen($oExcel, $Filepath) Local $LastRow = $File.Activesheet.Range("A1000000").End(-4162).Row _Excel_FilterSet($File, Default, Default, 1, "Test") For $j=1 To $LastRow If $File.Activesheet.Range("A"&$j).EntireRow.Hidden Then _Excel_RangeDelete($File.Activesheet,$j&":"&$j) Next I found a VBA macro that works great but I am having a hard time converting it to be able to use it in my script: Sub RemoveHiddenRows() Dim oRow As Range, rng As Range Dim myRows As Range Set myRows = Intersect(Sheets("Sheet1").Range("A:A").EntireRow, Sheets("Sheet1").UsedRange) For Each oRow In myRows.Columns(1).Cells If oRow.EntireRow.Hidden Then If rng Is Nothing Then Set rng = oRow Else Set rng = Union(rng, oRow) End If End If Next If Not rng Is Nothing Then rng.EntireRow.Delete End Sub I would really appreciate it if anyone can help me so I can use this part in my autoit script. Thanks.
  13. I have more than 12 workbooks opened together, if i wanted to attach to the last workbook opened it will take more than 1 minute ! Is there any solution for that ?
  14. Hello! where should I start, if I want to have a Progress Bar while waiting for my File to be open, can I use WinWaitActive? Thanks,
  15. I am still a noob and not a programmer, would greatly appreciate your help. Task: Open Excel file with file path and name: C:\Users\GENOBEAUTYPC1\Desktop\ACTIVE BEAUTY LABELS\BeautyMe Label 200ml ACTIVE VERSION.xlsx This file path and name is saved in the variable: $sAnswer Go to Excel Tab called "formular" Go to Cell A1 Insert the text saved in the variable: $sAnswer2 ATTENTION!!! This has 2 problems. Problem number 1: This text contains special characters that need to be interpreted as raw text. (content is: Gemischt für#30 ml#Mindestens haltbar bis#Maria Wallerstorfer#Anwendung: Täglich 1x morgens auf das gereinigte Gesicht auftragen. Augenkontakt vermeiden.#Über 0 C° und unter 25 C° lagern.#Lot:N8A1028/D30/V2.1#Genome Plus GmbH#Georg-Wrede-St. 13, D-83395 Freilassing#GEN SERUM#DAY) Problem number 2: This textis longer than 255 characters. Can anyone help me? I try to do it really primitively by opening the excel, waiting until it is open, clicking where the tab is, clicking where the cell is and inserting the content of the variable, but I am stuck at the point where I am limited by 255 characters. ; Opening the right excel FileChangeDir tooltip("File exists and is called:"&$sAnswer ,300,300) ShellExecute($sAnswer ,"" ,"" ,"" , @SW_MAXIMIZE) sleep(7000) tooltip("Now lets insert the right content into the excel",300,300) MouseClick("left",226,1004) MouseClick("left",52,179) sleep(500) Send("A1") sleep(500) send("{enter}") tooltip("inserting label content",300,300) sleep(500) Send($sAnswer2, 1) tooltip("inserting INCIS",300,300) sleep(5000) Send($sAnswer3, 1) sleep(5000)
  16. Hi guys. I know this is a newbie topic, very newbie, but i've read a lot of stuff and still don't get it. I just need to copy something from Excel cell, paste this in other program, copy something in this program and paste in other Excel cell. Something like... Copy A2 Use some WindowActivate and MouseMove stuff and CTRL+C (not a problem) Go back to the Excel sheet Paste that content in C2 Then Copy A3 Use some WindowActivate and MouseMove stuff and CTRL+C (not a problem) Go back to the Excel sheet Paste that content in C3 ... And it goes on The problem is, how can i "communicate" with Excel and do this row change? Like A2 to C2 and A3 to C3 ... In a efficient way that can be done like hundreds of times. Very newbie question but still not understanding this. Ty guys.
  17. Dear members of the forum, I need to open excel files that may or may not need a password and finally move the files that needs password to manual queue. Is there a fastest way to do this? PS: I have a huge respect for the rules of this forum. I am not asking assistance to override any security measure. I just need to segregate the files that needs passwords.
  18. Hi guys, without including everything (unless you want it) I am copying data from a table in chrome and wanting to paste it into excel. Copying in Chrome works. I can paste it into the field i want by emulating goto -> ctrl V: WinActivate($dataload) WinWaitActive($dataload) Sleep(500) $oWorkbook1.Sheets("ItemReturn").Activate Sleep(500) $msg = "Measuring Sheet" conwrite() ttips2() Local Const $xlUp = -4162 With $oWorkbook1.ActiveSheet ; process active sheet $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) ; get a Range that contains the last used cells $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, "B")).Rows.Count ; get the the row count for the range starting in row/column 1 and ending at the last used row/column $iLastCell = .Cells($iRowCount + 1, "B").End($xlUp).Row ; start in the row following the last used row and move up to the first used cell in column "B" and grab this row number EndWith $NewStartCell = $iLastCell + 2 $msg = "moving to location" conwrite() ttips2() Sleep(250) Send("^g") WinWait("Go To") Sleep(100) Send("B" & $NewStartCell) Sleep(100) Send("{ENTER}") Sleep(500) Send("^v") But, I want to use _excel_rangecopypaste, pasting from the clipboard _Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, default, "B" & $NewStartCell,default,$xlPasteValuesAndNumberFormats) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 2", "Error pasting cells." & @CRLF & "@error = " & @error & ", @extended = " & @extended) however, this gives me error 4 , extended@: -2147352567 How can i fix this or find out how to debug this error? Thanks
  19. Hi. I try to figure out who is using a excel workbook which I can only open "read only". I use this code: #include <Array.au3> #include <Excel.au3> Local $sFile = ; excel file with path on a network drive Local $oExcel = _Excel_Open(True, True) Local $oTabelle = _Excel_BookOpen($oExcel, $sFile) Local $aUsers If IsObj($oTabelle) Then $aUsers = $oTabelle.UserStatus _ArrayDisplay($aUsers) EndIf If I am the one allowed to write to the excel file (I'm the first one who opened it) then I will get an array with myself: If my collegue opened the excel file first and I run the code I get the following error message: "H:\_Conrad lokal\Downloads\AutoIt3\_COX\Tests\test.au3" (9) : ==> The requested action with this object has failed.: $aUsers = $oTabelle.UserStatus $aUsers = $oTabelle^ ERROR The excel file is on a network drive. Is that's the problem? Regards, Conrad
  20. Dear all, Can someone show me how to en hance the below function to write in CSV into column and rows the input values ? I am getting this result: I would like the result to be as this From A1:C1 is for headers From A2:C2 is for input Data Global Const $GUI_EVENT_CLOSE = -3 $sDataFilePath = @ScriptDir & "\Records.csv" #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Demo1: New Record", 580, 115) $Input1 = GUICtrlCreateInput("", 10, 30, 270, 21) $Input2 = GUICtrlCreateInput("", 300, 30, 270, 21) $Input3 = GUICtrlCreateInput("", 10, 80, 270, 21) $Label1 = GUICtrlCreateLabel("Name:", 10, 10, 35, 17) $Label2 = GUICtrlCreateLabel("ID:", 300, 10, 18, 17) $Label3 = GUICtrlCreateLabel("Phone No:", 10, 60, 55, 17) $Button1 = GUICtrlCreateButton("Save to CSV", 450, 70, 120, 30) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ExportData() MsgBox(64, @ScriptName, "Record Saved.") EndSwitch WEnd Func _ExportData() If Not FileExists($sDataFilePath) Then FileWriteLine($sDataFilePath, "Name;ID;Phone No.;") EndIf For $i = $Input1 To $Input3 FileWrite($sDataFilePath, GUICtrlRead($i) & ";") Next FileWriteLine($sDataFilePath, "") EndFunc ;==>_ExportData May be Excel UDF has be to be added but I can manage that my self Thank you in advance
  21. HI there this is driving me nuts - i get the row count, but not the column count - what am I missing? Thanks for your help! #include <Excel.au3> #include <Array.au3> #include <MsgBoxConstants.au3> ; XlDirection enumeration: https://msdn.microsoft.com/en-us/library/office/ff820880.aspxGlobal $oExcel = _Excel_Open() Global $xlup = -4162 Global $xlByRows, $xlPrevious, $xlByColumns Global $oExcel = _Excel_Open() $bookname = "temp.xlsx" $sWorkbook = @ScriptDir & "\" & $bookname Global $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, Default, Default, True) With $oWorkbook.ActiveSheet ; process active sheet $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) ; get a Range that contains the last used cells $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Rows.Count ; get the the row count for the range starting in row/column 1 and ending at the last used row/column $iColCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Column.Count MsgBox(0, "", "row:" & $iRowCount & "Col:" & $iColCount) EndWith for context - i want to : * count columns used in excel * create ini file from the rows in each column - finishing at the last column used - i.e. one column for one ini file; containing 15 rows or so. is it better to read the entire sheet to an array via the sheettoarray function? then read it from that? temp.xlsx
  22. I am working on a script that will turn all file names in a directory into an array, and then writes this Array to an Excel file. This in itself is working, but the RangeWrite function always puts the Array count in the first cell. How can i make sure this does not happen? I can of course just filter it out in Excel, but i am trying to keep all logic of filtering text in my script. This is what my script looks like: Local $Yesterday = _DateAdd('d', -1, _NowCalcDate()) Local $cDate = StringReplace($Yesterday, "/", "-") Local $aFileList = _FileListToArray(@WorkingDir & "/" & $cDate, "*") Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aFileList)
  23. Sorry if this is a repost, but having some trouble searching for the answer and pretty tired right now. I'm just wondering how to make a border around a range of cells in Excel. I want the regular lines created by selecting "All Borders" option around F2:G3 I saw this code: With $oExcel.ActiveSheet.range("F2:G3") .Select .Borders($xlEdgeBottom).LineStyle = $xlContinuous .Borders($xlEdgeBottom).Weight = $xlThick .Borders($xlEdgeBottom).ColorIndex = $xlAutomatic EndWith but I get errors of these variables not existing. It seems these no longer exist in the "#include <Excel.au3>" Is there another include file I need? I got this to work for highlighting cells, wondering if there is a option similar to this for all borders? $oExcel.ActiveSheet.Range("F2:G3").Interior.ColorIndex = 6 Thanks
  24. Hello, Is there a way wherein I can access the data from an array coming from an Excel file then have it assigned on to a variable? Below is a snippet of my current code. For now, it just reads and outputs the data from the excel file and have it displayed via an array. #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> Local $oExcel = _Excel_Open(False) If @error Then Exit MsgBox(0, "Error", "Error creating application object." & @CRLF & "Error: " & @error & " Extends: " & @extended) ; Open Excel Woorkbook and return object Local $sWorkbook = @ScriptDir & "\Excel Files\Test Data.xlsx" Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, False, True) If @error Then MsgBox(0, "Error", "Error opening workbook'" & $sWorkbook & ".'" & @CRLF & "Error: " & @error & "Extends: " & @extended) _Excel_Close($oExcel) Exit EndIf Local $aResult = _Excel_RangeRead($oWorkbook) ; Error Trapping If @error Then MsgBox(0, "Error", "Error reading data from '" & $sWorkbook & ".'" & @CRLF & "Error: " & @error & " Extends: " & @extended) _Excel_Close($oExcel) Exit EndIf _ArrayDisplay($aResult) My Excel file has values from Column A to H with values from 1 to 30, what I desired to do is have the value in "A7" assigned on to a variable. Any help is appreciated. Thanks in advance.
  25. I am trying to close an excel file that was not opened with _Excel_Open. How do I found the excel application object? I'm new and I am used to files and folders names, so an 'object' is new to me. I have the info too and simply spy, but I don't know which info is the object name/string. In the example from help doc's I see the code below and I tried justin pasting it into Scite. < Local $oExcel1 = ObjCreate("Excel.Application") ; Close the Excel instance which was not opened by _Excel_Open ; (will still be running because it was not opened by _Excel_Open) _Excel_Close($oExcel1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example 1", "Error closing the Excel application." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Sleep(2000) Local $aProcesses = ProcessList("Excel.exe") MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example 1", "Function ended successfully." & @CRLF & @CRLF & $aProcesses[0][0] & " Excel instance(s) still running.") >
×