16 posts in this topic
Creating new excel file
I've been searching, and reading the documentation, but I can't get this to work.
I need to programmatically create a new Excel (xlsx) file in a directory.
The examples I've seen online are using an excel workbook that already exists, and just renaming it or changing the file format.
I'm sure it is really simple, but I can't get it to work. This is what I have:
Local $oExcelTest = _Excel_Open() _Excel_BookNew($oExcelTest,5) Local $sWorkbook = @ScriptDir & "\testFile.xlsx" _Excel_BookSaveAs($oExcelTest, "testFile.xlsx", $xlWorkbookDefault, True); Sleep(50);
I've tried making the 2nd parameter $sWorkbook, but that doesn't change anything. The script does open a new excel window with 5 sheets, but it doesn't change the name and save it.
Excel UDF not attaching when multiple books open
If I have workbook open and active besides CardID.xlsm open, the script blows up. Is there anyway to fix this, CardID.xlsm is always open, but if I want to also work in Excel my script basically doesn't function.
Local $sWorkbook = "CardID.xlsm"
$oWorkbook = _Excel_BookAttach($sWorkbook, "filename")
Incremental copy paste
Hello Autoit community
I started using Autoit about 2 weeks ago and have found myself lost looking for information. Majority of the Help options are very easy to understand but I think that my general lack of knowledge about programming has slowed my progress. I tried very hard to not be that guy asking annoying questions on the forum but I’m afraid I’m out of options…
The steps below are my attempt to explain my scenario
Step 1: open excel file
Step 2: Read range of Excel column “A1” – “A???”) The range of rows will vary from sheet to sheet.
Step 3: take the values (one cell at a time) and place one value into my web browser ran program.
Step 4: if that value has been added before (indicated by the PixelSearch) than delete (represented by the mouse click) and start the loop over moving onto the next cell.
Step 5: if that value is new then submit the value (represented by the 2 mouse clicks at the end of the (if function)
The code listed below is as far as I got. I hope this explanation will suffice and I look forward to any help I can get.
(From WinActive(“Paste Too”) down is working as intended.)
_ExcelReadCell() - undefined function ?
Before I created my script with Windows 7 pro 32bit computer with Office 2013 32bit, and it's working on all my computers with Win7, Win8, Win10 with office 32 and 64bit...
Now I want to edit it on Windows 10 pro 64bit Computer with Office 2016 64bit and I get error: _ExcelReadCell() - undefined function. Can this computer or office version cause the problem? Excel.au3 is included.
Here is the part of my script:
Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, $xlsRepairs&$sItem) $CVDevice = _ExcelReadCell($oExcel, 1, 2) ; Device name $CVeqrma = _ExcelReadCell($oExcel, 3, 3) ; EQRMA Number $CVlot = _ExcelReadCell($oExcel, 5, 3) ; Lot number $CVpn = _ExcelReadCell($oExcel, 8, 3) ; PN $CVsn = _ExcelReadCell($oExcel, 11, 3) ; SN $CVreceived = _ExcelReadCell($oExcel, 17, 3) ; received $CVDevIdent = _ExcelReadCell($oExcel, 1, 2) ; Device identification $CVProjIdent = ($oExcel, 2, 2) ; Project identification _Excel_Close($oExcel)
_Excel_RangeReadEx Object Error
So I have been enjoying leveraging the Excel UDF but have run into a little trouble with the _Excel_RangeReadEx function.
I am getting an error that says this :
I then found this ( https://www.autoitscript.com/forum/topic/169779-excel-range-find-function-giving-bad-results/#comment-1240352 )
And gave his "Slightly modified" version of the script a go with the same error except the UDF was excel2 as I couldn't over-write the original.
The function that leverages this is as follows :
Func rangeFinder () $inputDist = GUIctrlRead ($dispDist) Local $finderKeeper001 = _Excel_RangeFindEx ($oWorkbook, $inputDist) ConsoleWrite ($finderKeeper001) EndFunc The other functions within the same ( entire ) script function well so it's just this that's giving me issues.
In summary I am just looking for the script to locate the cell(s) that contain that value and return it's location so I can then further process things in my little world
Thanks for your time!