Followers 0

# ExcelCOM UDF

## 243 posts in this topic

#21 ·  Posted

hi,

You are right, I ahd an error in my functions, where the default $Sheet was set to a number intead of a string (expected), so it was always looking at sheet number 1, I think (your test was adding to sheet 1); thanks again; corrected UDF as well as your etst script$var1=

#include<ExcelCom.au3>

; none of these shorter commands are visible until you say "_XLshow"

dim $FilePath,$var1,$LastRow$FilePath="C:\A3Test.xls"

If Not FileExists($FilePath) Or Not StringInStr($FilePath, "xls") Then

$FilePath = FileOpenDialog("Go - Choose your excel file as inbuilt one not exists",$FilePath, "Worksheet" & " (" & "*.xls" & ")", 1)

EndIf

$var1=_XLadd($FilePath,3,"E",7,30)

_XLshow($FilePath,3) msgbox (0,"_XLadd=",$var1)

_XLshow ($FilePath, 1)$var13=_XLadd($FilePath,1,"A",1,30) Exit it should put "30" in the 1st cell in row A Edited by blitzkrg #### Share this post ##### Link to post ##### Share on other sites #37 · Posted Hi, For completenes, i would "add" twice; and I would always exit (or, new, "close", which ill leave Excel running) else you'll find later the script won't work as the worksheet is "already open" if you run it again;$var13=_XLadd($FilePath,1,"A",1,30) _XLshow ($FilePath, 1)

MsgBox(0,"$FilePath=",$FilePath)

MsgBox(0,"","")

_XLexit(\$FilePath,"NoSave")

Exit

##### Share on other sites

#38 ·  Posted

if he does "no save" and exit

it wont save his work, correct?

so when he opens the spreadsheet to see what it did, he'd find nothing.

if you just go and double click on it, it will say it's already running..

but that's ok.. since you only had a problem with "add" right?

##### Share on other sites

#39 ·  Posted

Yes, OK!

the "show" and message box read the changes even if they are not saved; the exit without the "NoSave", or with a save as well would save too if needed.

Unfortunately, DaliMan has a problem I haven't sorted out yet, and cannot reproduce.......

Best, Randall

##### Share on other sites

#40 ·  Posted (edited)

Updated Excel com to include fast import facility without having to use macro or Excel import function.

This is as quick as importing via Data import in excel (eg 388Mb, 23000x200 rows/cols in 2 minutes; [3000Kb=3Mb/sec?])

Simply opens the "csv" file as object, then copies "used range", then pastes where asked

column number just upperleft cell name only

see how it works; (last function in Excel.com)

Usage;

#include<ExcelCom.au3>

_XLcsvPaste(@ScriptDir&"\book1.xls",1,3,5,"Save",@ScriptDir&"\test1.csv")

Exit

Best, Randall Edited by randallc