Jump to content
MrCheese

column count - excel udf

Recommended Posts

MrCheese
Posted (edited)

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

Edited by MrCheese
context added

Share this post


Link to post
Share on other sites
Subz

Do you mean something like:

Global $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, Default, Default, True)
MsgBox(0,'', "Columns : " & $oWorkbook.ActiveSheet.Usedrange.Columns.Count & @CRLF & _
"Rows : " & $oWorkbook.ActiveSheet.Usedrange.Rows.Count)

 

  • Haha 1

Share this post


Link to post
Share on other sites
MrCheese

yes - that works. *faceplams*

I might have been using older Udf functionality.

 

thanks for your help!

Share this post


Link to post
Share on other sites
MrCheese

is it "better" to read the book into an array and then either _arrayextract or _arraytostring / _arraytoclip to get data out?

or

just _excel_rangeread 

noting that I'd need to convert columns to numbers to move along.

 

Share this post


Link to post
Share on other sites
Subz

Sorry didn't read the last part of your post, I would probably just write it to an Array and then go through the array to write to an Ini, can you explain why you want multiple ini files?  And how exactly would the Ini look?

[Row1]
ColA=...
ColB=...
Etc...

Can you explain further?

Share this post


Link to post
Share on other sites
Juvigy

Your initial code works. You just made a small mistake -

$iColCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Column.Count

Should be

$iColCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).ColumnS.Count

Share this post


Link to post
Share on other sites
MrCheese

 doh! columns!!!!

so, multiple ini files; unfortunately the ini format that i need isn't quite suitable for the IniWrite command, so I will use "filewriteline" and output as an ini.

So i create a template ini file, and modify what is required into column B, then reuse template in A, to create ini template C.

I then have a ini title in B1, C1, etc and use this to create the ini file name.

the ini filewriteline output would be from B2 -> B20; then the next ini would be C2->C20

this ini file name is then referred to when I create a shortcut.

So now, I create a shortcut which are sequential, as I will run 16 instances of the same program (multiple copies of the program); which all launch the particular ini that has been associated with that shortcut (shortcut file name also refers to ini file name).

if i don't have enough ini templates, then shortcuts will be created (up to 16) without the addition of the ini reference in the shortcut argument.

ini example:

; start strategy tester 
  TestExpert=Market\File
  TestExpertParameters=setfiles\
  TestSymbol=Fxpair
  TestPeriod=Timeframe
  TestModel=0
  TestSpread=15
  TestOptimization=False
  TestDateEnable=true 
  TestFromDate=2010.01.01 
  TestToDate=2018.04.22
  TestReport=reports\
  TestReplaceReport=false 
  TestShutdownTerminal=false

 

code thus far:

Opt("WinTitleMatchMode", 2)

#include <Excel.au3>
#include <MsgBoxConstants.au3>


HotKeySet("{F2}", "Terminate")
HotKeySet("{F3}", "TogglePause")

$terminalstart = 1

$terminaltotal = 16

$columnstart = 2 ; column of first template

$iStartrow = 2 ; row of first part of ini

$bookname = "automated_tests.xlsx"
$sWorkbook = @ScriptDir & "\" & $bookname
Global $paused, $settitle, $inititle, $oWorkbook, $iRows, $iCols

$dir1 = @ScriptDir & "\"
$file = "\program.exe"
$lnk1 = @ScriptDir & "\"
$lnk2 = ".lnk"
$args = " /portable /wait "

$inidir = @ScriptDir & "\"

excelstart()

For $i = $terminalstart To $terminaltotal

    $col = $i - $terminalstart + $columnstart
    If $col <= $iCols Then
        createini()
    Else
        $settitle = ""
    EndIf
    createshortcut()

Next



;=============================
Func excelstart()
    Global $oExcel = _Excel_Open()

    WinActivate($bookname)
    If WinActivate($bookname) = 0 Then
        $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, Default, Default, True)
    Else
        $oWorkbook = _Excel_BookAttach($sWorkbook)
    EndIf

    Global $aResult = _Excel_RangeRead($oWorkbook)

    $iRows = UBound($aResult, $UBOUND_ROWS) ; Total number of rows. In this example it will be 10.
    $iCols = UBound($aResult, $UBOUND_COLUMNS) ; Total number of columns. In this example it will be 20.
    $iDimension = UBound($aResult, $UBOUND_DIMENSIONS) ; The dimension of the array e.g. 1/2/3 dimensional.

EndFunc   ;==>excelstart


Func createini()


    Local $aIni = _ArrayToString($aResult, @TAB, $iStartrow - 1, -1, @CRLF, $col - 1, $col - 1)
    Local $aTitle = _ArrayToString($aResult, @TAB, $iStartrow - 2, $iStartrow - 2, @CRLF, $col - 1, $col - 1)
    ;MsgBox($MB_SYSTEMMODAL, "", "aINI value: " & $aIni & " | aINI value:  " & $aTitle & " | ")
    $settitle = $aTitle
    $inititle = $aTitle & ".ini"

    Local Const $sFilePath = $inidir & $inititle
    FileWrite($sFilePath, $aIni)

EndFunc   ;==>createini

Func createshortcut()
    $sFilePath = @ScriptDir & "\filename" & $i & "_" & $settitle & $lnk2
    FileCreateShortcut($dir1 & $i & $file, $sFilePath, $dir1 & $i, $args & $inidir & $inititle)
    If $col <= $iCols Then
        FileCreateShortcut($dir1 & $i & $file, $sFilePath, $dir1 & $i, $args & $inidir & $inititle)
    Else
        FileCreateShortcut($dir1 & $i & $file, $sFilePath, $dir1 & $i, $args)
    EndIf
EndFunc   ;==>createshortcut


Func Terminate()
    $exit = MsgBox(4, "Template Creater", "End the process?")
    If $exit = 6 Then
        Exit
    EndIf
EndFunc   ;==>Terminate

Func TogglePause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
EndFunc   ;==>TogglePause

 

hope that helps

Share this post


Link to post
Share on other sites
Subz

Sorry before I start, can you provide a basic example file, from what I can tell you want

A1 = FileName

A2=B2
A3=B3
etc...

C1 = FileName

C2=D2
C3=D3
etc...

Is this correct or do I have it all wrong?

Share this post


Link to post
Share on other sites
MrCheese

oh mate - i have it working well. as per the script I included above.

it was that i had to use filewrite instead of iniwrite due to that I had the "=" and both sides of text within the one cell.

Let me know if you have any questions though.

Share this post


Link to post
Share on other sites
MrCheese

I added this too, which populates the automated template sheet with file names and copies the template information across.

 

see my attached spreadsheet.

 

if $tempload= true Then

$aFilelist = _FileListToArray($setdir)
$iRowsF = UBound($aFilelist, $UBOUND_ROWS)

_ArrayTrim($aFilelist,4,1,1)
_ArrayDisplay($aFilelist,"file list")

_ArrayTranspose($aFilelist)
_ArrayDisplay($aFilelist,"file list transpose")
_Excel_RangeWrite ( $oWorkbook, Default, $aFilelist,"A1" )

;_Excel_BookSave($oWorkbook)

$sLetter = _Excel_ColumnToLetter($iRowsF)

_Excel_RangeCopyPaste ( $oWorkbook.ActiveSheet, "B2:B"&$iRows+1 , "C2:"&$sLetter&"2")

_Excel_BookSave($oWorkbook)

    Global $aResult = _Excel_RangeRead($oWorkbook)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 3", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    ;MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 3", "Data successfully read." & @CRLF & "Please click 'OK' to display all formulas in column A.")
    ;_ArrayDisplay($aResult, "Excel UDF: _Excel_RangeRead Example 3 - Formulas in column A")

    $iRows = UBound($aResult, $UBOUND_ROWS) ; Total number of rows. In this example it will be 10.
    $iCols = UBound($aResult, $UBOUND_COLUMNS) ; Total number of columns. In this example it will be 20.
    $iDimension = UBound($aResult, $UBOUND_DIMENSIONS) ; The dimension of the array e.g. 1/2/3 dimensional.
;Exit
EndIf

temp.xlsx

Share this post


Link to post
Share on other sites
Subz

Cool, looks like you got it sorted, I was thinking more along the lines that A Column had Ini Key and you were combining that with the Values in Column C -> G.  Thought I'd post my method, comments are in the code:

Opt("WinTitleMatchMode", 2)

#include <Excel.au3>
#include <MsgBoxConstants.au3>


HotKeySet("{F2}", "Terminate")
HotKeySet("{F3}", "TogglePause")

Global $paused

_CreateShortcuts(16)

;=============================
Func _CreateShortcuts($_iShortcutCount = Default)
    Local $hIniFileOpen
    Local $sIniFilePath = @ScriptDir
    Local $sProgramDir = @ScriptDir
    Local $sProgramPath = $sProgramDir & "\Program.exe"
    Local $sShortcutPath = @ScriptDir & "\Filename"
    Local $sShortcutArgs = "/portable /wait"

    Local $aWorkFile[1][2], $sWorkbook = @ScriptDir & "\Temp.xlsx"

    Local $oExcel = _Excel_Open()
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
        If @error Then $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, Default, Default, True)
            If @error Then Exit MsgBox(4096, "Error", "Error Reading: " & $sWorkbook)
    Local $aWorkbook = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange)
        If @error Then Exit MsgBox(4096, "Error", "Error Reading Range for: " & $sWorkbook)
    Local $aTempbook = $aWorkbook                                               ;~ Create a TempBook Array from WorkBook Array
    Local $iShortcutCount = $_iShortcutCount = Default ? UBound($aWorkbook, 2) - 1 : $_iShortcutCount
    ;~ Loop through Columns
    For $i = 1 To $iShortcutCount
        If $i > UBound($aWorkbook, 2) - 1 Then                                  ;~ If the index is greater than the Workbook Array, Create shortcuts only.
            FileCreateShortcut($sProgramPath, $sShortcutPath & $i & "_.lnk", $sProgramDir, $sShortcutArgs)
        Else
            $sIniFileName = $sIniFilePath & "\" & $aTempbook[0][1] & ".ini"     ;~ Cell B1 = File Name
            $sIniFileData = _ArrayToString($aTempbook, "", 1, -1, @CRLF, 1, 1)  ;~ Column B to String
            $hIniFileOpen = FileOpen($sIniFileName, 2)                          ;~ FileOpen with Flag set to delete contents of file, otherwise data would be appended
                FileWrite($sIniFileName, $sIniFileData)                         ;~ Write Column B String to Ini File
            FileClose($hIniFileOpen)                                            ;~ Close FileOpen Handle
            FileCreateShortcut($sProgramPath, $sShortcutPath & $i & "_" & $aTempbook[0][1] & ".lnk", $sProgramDir, $sShortcutArgs & " " & $sIniFileName)
            _ArrayColDelete($aTempbook, 1)                                      ;~ Delete Column B from the TempBook Array
        EndIf
    Next
EndFunc   ;==>_CreateShortcuts

Func Terminate()
    $exit = MsgBox(4, "Template Creater", "End the process?")
    If $exit = 6 Then
        Exit
    EndIf
EndFunc   ;==>Terminate

Func TogglePause()
    $paused = Not $paused
    While $paused
        Sleep(50)
    WEnd
EndFunc   ;==>TogglePause

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • robertocm
      By robertocm
      I'm using this for replacing text strings in the VBProject of all excel files in a folder and subfolders.
      I have the same text string in several lines and those lines could have some differences between files: then not feasible for .ReplaceLine method
      I'm not interested in placing all the code in a xla AddIn, because the code is similar but not exactly the same in all the files.
       
      Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase #include <File.au3> #include <WinAPIFiles.au3> #include <Excel.au3> $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ;Install a custom error handler Global $iEventError ; to be checked to know if com error occurs. Must be reset after handling. Global Const $sMessage = "Select Folder" Global $sFileSelectFolder = FileSelectFolder($sMessage, "") If @error Then MsgBox(0, "", "No folder was selected.") Exit EndIf Global $bFileOpen ;Look for excel files in selected directory and all subdirectories Global $aFileList = _FileListToArrayRec($sFileSelectFolder, "*.xlsm", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) If Not @error Then Local $oAppl = _Excel_Open(Default, Default, False, Default, True) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_Open" & @CRLF & "@error = " & @error & ", @extended = " & @extended) For $i = 1 To $aFileList[0] $bFileOpen = _WinAPI_FileInUse($aFileList[$i]) If $bFileOpen = 0 Then ;ShellExecute($aFileList[$i]) Local $oWorkbook = _Excel_BookOpen($oAppl, $aFileList[$i]) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_BookOpen: " & $sFilePath & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oProject = $oWorkbook.VBProject ;From: Adapt VBA in a workbook using VBA / http://www.snb-vba.eu/index_en.html ;2.7.2 Macromodule delete With $oProject .VBComponents.Remove(.VBComponents("SplashText")) If $iEventError Then Consolewrite("SplashText Form not found: " & $aFileList[$i] & @CRLF) $iEventError = 0 ; Reset after displaying a COM Error occurred EndIf .VBComponents.Import("C:\Documents and Settings\XP\Escritorio\PLANTILLAS_EXPORT\SplashText.frm") EndWith ;3.2.1.8 Macro: delete With $oProject.VBComponents("Actual").CodeModule ;3.2.1.2 Macro: find If .Find("Sub Check_NumPed(", 1, 1, -1, -1) Then ;Note: using '+ 1' at the end of the line because i'm used to add an empty line between procedures (see vba help for ProcCountLines) .DeleteLines( .ProcStartLine("Check_NumPed", 0), .ProcCountLines("Check_NumPed", 0) + 1) EndIf EndWith ;Check if range name exists. If not create named ranges If Not IsObj($oWorkbook.Sheets("DATOS").Evaluate("Booking_DestPort")) Then ;If Not IsObj($oWorkbook.Sheets("DATOS").Range("Booking_DestPort")) Then If $oWorkbook.Sheets("DATOS").Range("AC7").value = "DestPort" Then $oWorkbook.Names.Add("Booking_DestPort", "=DATOS!$AC$8") Else ConsoleWrite("-> Not: 'DestPort' in AC7" & @TAB & $aFileList[$i] & @CRLF) EndIf If $oWorkbook.Sheets("DATOS").Range("AD7").value = "FinalDest" Then $oWorkbook.Names.Add("Booking_FinalDest", "=DATOS!$AD$8") Else ConsoleWrite("-> Not: 'FinalDest' in AD7" & @TAB & $aFileList[$i] & @CRLF) EndIf EndIf ;Open VBE Editor (like Alt+F11) $oAppl.VBE.MainWindow.Visible = True ;$oAppl.VBE.Windows("Inmediato").Visible = True ;https://www.autoitscript.com/forum/topic/77545-resolved-vbaofficeexcel-experts/ ;Spiff59, Aug 2008 ;Local $oModules = $oProject.VBComponents ;Local $oModules = $oWorkbook.VBProject.VBComponents ;$oModules.Item(1).CodeModule.CodePane.Show ;$oModules.Item(1).Activate ; With $oModules.Item($y).CodeModule ; .ReplaceLine (1 , "Sub SpellCheck()") ; .DeleteLines (10, 1) ; .InsertLines (7 , "TEST") ; EndWith ;Wait 30 seconds for the window to appear. Local $hWnd = WinWait("Microsoft Visual Basic - ", "Proyecto - VBAProjec", 30) WinActivate($hWnd) WinWaitActive($hWnd, "", 30) If WinActive($hWnd, "") Then ;Sleep(100) ;Send("{F7}") $oProject.VBComponents("Actual").Activate ;Wait 30 seconds for the window to appear. Local $hWnd2 = WinWait(" - [Actual (Código)]", "Proyecto - VBAProject", 30) WinActivate($hWnd2) WinWaitActive($hWnd2, "", 30) ;First Replace If WinActive($hWnd2, "") Then Send("{CTRLDOWN}h{CTRLUP}") ;Wait 30 seconds for the window to appear. Local $hWnd3 = WinWait("Reemplazar", "&Procedimiento actua", 30) WinActivate($hWnd3) WinWaitActive($hWnd3, "", 30) Sleep(100) Send('Sheets("DATOS").Range("AC8")') Sleep(200) Send("{TAB}") Sleep(100) ;Send("{DEL}") Send('Range("Booking_DestPort")') Sleep(200) ControlClick("Reemplazar", "", "[ID:4892]") Sleep(100) Send("{ALTDOWN}z{ALTUP}") Local $hWnd4 = WinWait("Microsoft Visual Basic", "Se ha buscado en la ", 2) ;WinActivate($hWnd4) ;WinWaitActive($hWnd4, "", 3) If WinActive($hWnd4, "") Then Sleep(100) Send("{SPACE}") Else Consolewrite("Not found 1: " & $aFileList[$i] & @CRLF) Local $hWnd5 = WinWait("Microsoft Visual Basic", "No se encontró", 0) ;WinActivate($hWnd5) ;WinWaitActive($hWnd5, "", 2) Sleep(100) Send("{SPACE}") EndIf Sleep(100) If WinActive($hWnd3, "") Then ;Alt+F4 Send("!{F4}") Sleep(100) EndIf EndIf ;Second Replace If WinActive($hWnd2, "") Then Send("{CTRLDOWN}h{CTRLUP}") ;Wait 30 seconds for the window to appear. Local $hWnd3 = WinWait("Reemplazar", "&Procedimiento actua", 30) WinActivate($hWnd3) WinWaitActive($hWnd3, "", 30) Sleep(100) Send('Sheets("DATOS").Range("AD8")') Sleep(200) Send("{TAB}") Sleep(100) Send('Range("Booking_FinalDest")') Sleep(200) ControlClick("Reemplazar", "", "[ID:4892]") Sleep(100) Send("{ALTDOWN}z{ALTUP}") Local $hWnd4 = WinWait("Microsoft Visual Basic", "Se ha buscado en la ", 2) ;WinActivate($hWnd4) ;WinWaitActive($hWnd4, "", 3) If WinActive($hWnd4, "") Then Sleep(100) Send("{SPACE}") Else Consolewrite("Not found 2: " & $aFileList[$i] & @CRLF) Local $hWnd5 = WinWait("Microsoft Visual Basic", "No se encontró", 0) ;WinActivate($hWnd5) ;WinWaitActive($hWnd5, "", 2) Sleep(100) Send("{SPACE}") EndIf Sleep(100) If WinActive($hWnd3, "") Then ;Alt+F4 Send("!{F4}") Sleep(100) EndIf EndIf ;Close VBE Editor If WinActive($hWnd2, "") Then $oAppl.VBE.ActiveWindow.Close ;Send("^{F4}") ;Sleep(100) ;Send("^s") $oAppl.VBE.MainWindow.Visible = False ;Sleep(100) ;Send("!{F4}") EndIf EndIf _Excel_BookClose($oWorkbook, True) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_BookClose: " & $sFilePath & @CRLF & "@error = " & @error & ", @extended = " & @extended) EndIf Next Else MsgBox(16, "Error", "No files were found in the folder specified.") EndIf _Excel_Close($oAppl) ;If @error Then Exit MsgBox(0, "Error", "Error _Excel_Close" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;This is a custom error handler Func ErrFunc() $HexNumber = Hex($oMyError.number, 8) ;~ MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ ;~ "Number is: " & $HexNumber & @CRLF & _ ;~ "WinDescription is: " & $oMyError.windescription) ConsoleWrite("-> We intercepted a COM Error !" & @CRLF & _ "-> err.number is: " & @TAB & $HexNumber & @CRLF & _ "-> err.source: " & @TAB & $oMyError.source & @CRLF & _ "-> err.windescription: " & @TAB & $oMyError.windescription & _ "-> err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF) $iEventError = 1 ; Use to check when a COM Error occurs EndFunc ;==>ErrFunc  
    • gahhon
      By gahhon
      Hi Guys,
      I was trying to read some data from the excel file and without opening the file. But I tried a lot of methods, it still open the file.
      And also, I am able to capture the ColumnA value but not Column B.
      Thanks for advance information.
      Global $oDataA, $oDataB Call ("ExcelRead", "B2", "C2") Func ExcelRead($oColumnA, $oColumnB) Local $oPath = @ScriptDir & "\MyFile.xlsx" Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, $oPath, 1, 0) $oDataA = _Excel_RangeRead($oWorkbook, "Sheet 1", $oColumnA) $oDataB = _Excel_RangeRead($oWorkbook, "Sheet 1", $oColumnB) MsgBox(0, "Test Value", $oDataA & ", " & $oDataB) EndFunc  
    • ed973
      By ed973
      I really don't understand how to save as an open excel sheet.
      I run a script that at the end open the excel: just only need to save as the opened excel on my desktop (and overwrite it everytime).
      I'm trying to use .ActiveWorkBook.SaveAs("C:\Users\Enrico\Desktop\impegnato.xlsx") but...
       
      Thanks in advance for helping.
    • yasha
      By yasha
      i want am trying to select a nimber to run a program and then select where to save the excel result at before hand
      the problem is that it does not save in the folder i want but the folder before any solutions
      #.................
      $sFolder = ""
          ; Create a constant variable in Local scope of the message to display in FileSelectFolder.
          Local Const $sMessage = "Select a folder"
          ; Display an open dialog to select a file.
          $sFileSelectFolder = FileSelectFolder($sMessage, $sFolder)
          If @error Then
              ; Display the error message.
              MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
          Else
              ; Display the selected folder.
              MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
          EndIf
      .......
      ........
      $oExcel = ObjCreate("Excel.Application")                   ; Create an Excel Object
      $oExcel.Visible = 1                                        ; Let Excel show itself
      $oExcel.Workbooks.Open("J:\OPS\OPS_Share\Planners\2 - Weekly Reports\Auto download\"& $YY & $MM & $DD & " ORDER.xls",0)
      $oExcel.ActiveWorkbook.Saveas ( $sFileSelectFolder,""& $YY & $MM & $DD & " ORDER.xlsx", 1)
      $oExcel.ActiveWorkBook.Close
      $oExcel.Quit
      i only want to save it as ddmmyy order inside documents but it saves in libraries as documents ddmmyy order.
    • PiyushJhawar
      By PiyushJhawar
      I am part of QA team of an analytics application. We support third party tools like Excel , Tableue .
      I have to write automation script that connect Excel to our analytics application. In short i want below to automate
      > Open Excel
      > Click on "Data" option available in header and then click on "From Other Services " then click on "From Analysis Services"
      > It will open pop up and then need to write username password there.
      I am new in this tool . Can any one please provide me link of any document that help me to create above script
×