
sumandevadiga
Active Members-
Posts
100 -
Joined
-
Last visited
Everything posted by sumandevadiga
-
Run Outlook Macro from Autoit Script
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello Logan Sorry for incomplete information, actually i was looking only for the autoscript which can execute the outlook macros, likewise i i used below script to run excel macros. Basically i have a Macro in Outlook which i would like to run every hour to check specific subject email and fetch the details and save in excel, so macro is ready only i required a autoit script which will active this macro every hour. let me know if more information required. #include <Excel.au3> #include <MsgBoxConstants.au3> $oExcel = _ExcelBookOpen ("C:\Test1\Test.xlsm") $oExcel.Run("SaveWorksheetsAsCsv") _ExcelBookClose($oExcel) -
Run Outlook Macro from Autoit Script
sumandevadiga posted a topic in AutoIt General Help and Support
Hello I would like to Run Outlook macros from Autoit every 1 hour, below script unable to run macros. While 1 $Minute = Random(1,59,1) Do Sleep(1000) Until @Min = $Minute ; do whatever ; Since we want it to run randomly once an hour, we need to calculate how much time is left before the hour is up, and sleep that length of time. $s = ((60 - $Minute) * 60) * 1000 Sleep($s) $oOApp = ObjCreate("Outlook.Application") $oOApp.Run("SaveAttachments") ; Run Outlook Macros WEnd -
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello Dan, Hello Dan, thank you very much, am able to complete this task successfully, below is my code. #include <IE.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> Local $DLG_NOTONTOP, $DLG_MOVEABLE,$k,$c,$d,$e Local $INET_FORCERELOAD,$sURL, $sPath,$sID,$INET_DOWNLOADWAIT,$hDownload,$INET_DOWNLOADCOMPLETE,$INET_DOWNLOADBACKGROUND,$b Local $iDelete = FileDelete("C:\Print2edoc\Downloads\") ControlSend("[CLASS:Progman; TITLE:Program Manager]", "", "", "{F5}") $oExcel = _ExcelBookOpen ("C:\Print2edoc\POD.xlsx") $NumberOfRows = $oExcel.ActiveSheet.UsedRange.Rows.Count Local $sPath = "C:\Print2edoc\Downloads\" If FileExists($sPath) Then Else DirCreate($sPath) EndIf ; Display a progress bar window. ProgressOn("POD Downloads", "Progress Bar", "0 File", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) ; Update the progress value of the progress bar window every second. For $a = 2 To $NumberOfRows $b = 0 WinActivate('EXCEL') $sID = _ExcelReadCell($oExcel,$a,1) Local $sURL = "http://spoton.co.in/SPOTTRACK/Advance/getpod.aspx?id=" & $sID & "&mPODDw=Y" Local $hDownload = InetGet($sURL, $sPath & $sID & ".jpg", $INET_FORCERELOAD,$INET_DOWNLOADBACKGROUND) Do Sleep(250) $b = $b + 1 Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) or $b = 10 InetClose($hDownload) $d = $NumberOfRows - 1 $c = $a - 1 $e = (100*$c/$d) ProgressSet($e,($c & "/" & $d & " " & "Files" )) Next ; Set the "subtext" and "maintext" of the progress bar window. ProgressSet(100, "Done", "100 % Complete") Sleep(5000) ProgressOff() _ExcelBookClose($oExcel) -
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello Dan, Can you advise why one of my colleague getting this attached error? #include <IE.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> Local $INET_FORCERELOAD,$sURL, $sPath,$sID Local $iDelete = FileDelete("C:\Print2edoc\JPG\") ControlSend("[CLASS:Progman; TITLE:Program Manager]", "", "", "{F5}") $oExcel = _ExcelBookOpen ("C:\Print2edoc\POD.xlsx") $NumberOfRows = $oExcel.ActiveSheet.UsedRange.Rows.Count Local $sPath = "C:\Print2edoc\JPG\" For $a = 2 To $NumberOfRows WinActivate('EXCEL') $sID = _ExcelReadCell($oExcel,$a,1) Local $sURL = "http://spoton.co.in/SPOTTRACK/Advance/getpod.aspx?id=" & $sID & "&mPODDw=Y" InetGet($sURL, $sPath & $sID & ".jpg", $INET_FORCERELOAD) Next _ExcelBookClose($oExcel) MsgBox(0,"Title","Script Completed") -
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello Dan, I have completed my project, this really helping me a lot, saving almost 5 hours a day of individual, only concern is sometime the suggested above command for downloading files doesn't give any result, not sure what exact issue is, rest everything is perfect. #include <Excel.au3> #include <MsgBoxConstants.au3> Local $sID,$oExcel,$a,$sURL,$sPath,$INET_FORCERELOAD,$sFilePath,$iFileExists,$b,$c Local $sPath = "C:\Print2edoc\JPG\" Run('C:\Program Files (x86)\PlotSoft\PDFill\PDFill_PDF_Tools.exe', "", @SW_MAXIMIZE) WinWaitActive("[REGEXPTITLE:PDFill PDF Tools 14.0.*]") $oExcel = _ExcelBookOpen ("C:\Print2edoc\POD.xlsx") WinActivate('EXCEL') $c = 0 Do $Text = WinGetTitle("[ACTIVE]") $screen1 = StringMid($Text,$c,5) $c = $c + 1 Until $screen1 = "EXCEL" $a = 2 Do $sID = _ExcelReadCell($oExcel,$a,1) $a = $a + 1 ;Check if file exists. Local $sFilePath = "C:\Print2edoc\Upload_Docs\" & $sID & ".jpg" Local $iFileExists = FileExists($sFilePath) $b = 2 DO ;Display a message after checking the returned value. If $iFileExists Then $b = 1 Else WinActivate('Program Manager') send("{F5}") Local $sURL = "http://spoton.co.in/SPOTTRACK/Advance/getpod.aspx?id=" & $sID & "&mPODDw=Y" $b = $b + 1 if $sID <> '' then InetGet($sURL, $sPath & $sID & ".jpg", $INET_FORCERELOAD) $b = 1 endif EndIf Until $b = 1 or $b = 50 Local $destdir,$destfile,$srcdir,$srcfile $srcDirectory = 'C:\Print2edoc\JPG' $destDirectory = 'C:\Print2edoc\Upload_Docs' $destdir = $destDirectory ; change current directory to src directory FileChangeDir($srcDirectory) $destfile = $sID & ".pdf" $srcdir = $srcDirectory $srcfile = $sID & ".jpg" $search = FileFindFirstFile($sID & ".jpg") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop ; MsgBox(4096, "File:", $file) $dest = StringReplace($file, ".jpg","") & ".pdf" WEnd ; Close the search handle FileClose($search) WinWaitActive("[REGEXPTITLE:PDFill PDF Tools 14.0.*]") ControlClick("[REGEXPTITLE:PDFill PDF Tools 14.0.*]", "", "[CLASS:Button; TEXT: 9. Convert Images to PDF]") WinWaitActive("[TITLE:Free PDF Tools: Convert images to PDF]") ; set paper size output to A4 ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:ComboBox; INSTANCE:1]") Send("A{ENTER}") ; set margins to 0 ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:Edit; INSTANCE:3]") Send("{HOME}{SHIFTDOWN}{END}{SHIFTUP}{DEL}0") ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:Edit; INSTANCE:4]") Send("{HOME}{SHIFTDOWN}{END}{SHIFTUP}{DEL}0") ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:Edit; INSTANCE:5]") Send("{HOME}{SHIFTDOWN}{END}{SHIFTUP}{DEL}0") ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:Edit; INSTANCE:6]") Send("{HOME}{SHIFTDOWN}{END}{SHIFTUP}{DEL}0") ; add an image ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:Button; TEXT:Add an Image]") WinWaitActive("[TITLE:Select Image files to add into PDF]") ; send image location followed by enter ControlClick("[TITLE:Select Image files to add into PDF]", "", "[CLASS:Edit; INSTANCE:1]") Send($srcdir & "\" & $srcfile & "{ENTER}") ; wait for window to return WinWaitActive("[TITLE:Free PDF Tools: Convert images to PDF]") ; click save-as ControlClick("[TITLE:Free PDF Tools: Convert images to PDF]", "", "[CLASS:Button; TEXT:Save As ...]") WinWaitActive("[TITLE:Save all the images as ... ]") ; send pdf output location followed by enter ControlClick("[TITLE:Save all the images as ... ]", "", "[CLASS:Edit; INSTANCE:1]") Send($destdir & "\" & $destfile & "{ENTER}") ; wait for adobe to open - and then close it down WinWaitActive("[TITLE:" & $destfile & " - Adobe Reader]") WinClose("[TITLE:" & $destfile & " - Adobe Reader]") Until $sID = '' ; wait for pdf image tools to return - and then close it down WinWaitActive("[TITLE:Free PDF Tools: Convert images to PDF]") WinClose("[TITLE:Free PDF Tools: Convert images to PDF]") ; wait for main pdf tools to return - and then close it down WinWaitActive("[REGEXPTITLE:PDFill PDF Tools 14.0.*]") WinClose("[REGEXPTITLE:PDFill PDF Tools 14.0.*]") MsgBox(0,"Title","Script Completed") -
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello Dan, Need help, my script almost completed, am getting attached error due to delay in attached dialog box popup, i tried many ways not sure how to hold the script till popup bar appears #include <IE.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> #include <ProgressConstants.au3> #include <DTC.au3> #include <ExcelConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <InetConstants.au3> #include <File.au3> #include <Code128Auto.au3> #include <IE.au3> #Include <WinAPI.au3> Local $text1 Local $filepath = "C:\Print2edoc\Upload_Docs" local $oIE = _IECreate("http://www.spoton.co.in/",1) _IELoadWait($oIE) local $Pod1 =_IEGetObjById($oIE,"txtpodconno") local $submitBtn =_IEGetObjById($oIE,"btnpodsubmit") $Pod1.value="514099869" _IEAction($submitBtn,"click") WinWait('POD View') Local $oIE2 = _IEAttach('POD View') local $podBtn =_IEGetObjById($oIE2,"podDownloadImg") _IELoadWait($oIE2) _IEAction($podBtn,"click") $hIE = WinGetHandle("[Class:IEFrame]") $hCtrl = ControlGetHandle($hIE,"","[Class:DirectUIHWND]") $aPos = ControlGetPos($hIE,"",$hCtrl) $x = $aPos[2]-160 $y = $aPos[3]-30 WinActivate($hIE) ;doesn't work in the background ControlClick($hIE,"",$hCtrl,"primary",1,$x,$y) ;this only gives focus to the save button ControlSend($hIE,"",$hCtrl,"{down}") ;this does work once the save button is focussed ControlSend($hie, "", "[Class:DirectUIHWND]","a") ;open save as dialog WinActivate("Save As", "Save"); WinWaitActive("Save As", "Save", 10); ControlSend("Save As", "", "[CLASS:Edit; INSTANCE:1]", "C:\Print2edoc\"&$Pod1.value&".jpg") ControlClick("Save As", "", "&Save", "left", 1, 5, 5); sleep(100) ControlClick("Confirm Save As","","Button1", "left", 1, 0, 0); ;quit ie _IEQuit($oIE) -
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
-
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello Dan, Thanks for the quick reply, yes, am able to open the POD image however tried to download and want to save in C drive(C:\Print2edoc\Upload_Docs) its not happening local $oIE = _IECreate("http://www.spoton.co.in/","",1) _IELoadWait($oIE) local $Pod1 =_IEGetObjById($oIE,"txtpodconno") local $submitBtn =_IEGetObjById($oIE,"btnpodsubmit") $Pod1.value="514099869" _IEAction($submitBtn,"click") _IELoadWait($oIE) WinActivate('POD View - Internet Explorer') local $podBtn =_IEGetObjById($oIE,"podDownloadImg") _IEAction($podBtn,"click") Quote <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style> .style1 { width: 75%; border-collapse: collapse; border: 1px solid #f2682b; } </style> </head> <body><form name="form1" id="form1" action="PODView.aspx?id=514099869" method="post"><div style="width: 100%; height: 100%; background-color: rgb(255, 255, 255);"><table align="center" class="style1" style="border: thin solid rgb(242, 104, 43); border-image: none;" border="0" frame="box"><tbody><tr><td style="text-align: center;"> <input name="imgPath" id="imgPath" type="hidden"> <input name="imgType" id="imgType" type="hidden"> <input name="strConNo" id="strConNo" type="hidden" value="514099869"> <input name="strImgTp" id="strImgTp" type="hidden"> <img id="podDownloadImg" style="cursor: pointer;" onclick="WindowOpen();" alt="Click to download POD" src="Images/downPOD.gif"> </td></tr></tbody></table></div></form></body> </html> Unquote -
click a button on a webpage
sumandevadiga replied to sumandevadiga's topic in AutoIt General Help and Support
Hello jlogan, Message Noted! -
Hello Need help on this, am trying below command to drop down Pod image search box, but this is not happening, can anyone help me to guide what is wrong in this Local $oIE = _IECreate("http://www.spoton.co.in/","",1) _IELoadWait($oIE) local $PodBtn=_IEGetObjById($oIE,"UPPODImages") _IEAction($PodBtn,"click") Quote <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style> * { margin: 0; padding: 0; } .form-box { float: left; width: 190px; padding: 5px 0 0 0px; background: #FFF6BF; margin-bottom: 10px; } .menu_body { display: none; } .menu_list { width: 190px; } #right-wrap .block-1 .list-box { float: left; width: 210px; padding: 5px 0 0 44px; } #right-wrap .block-1 { width: 100%; float: left; background: url(../images/dashed-line.jpg) left top repeat-y; padding: 0 0 20px; } #right-wrap { width: 260px; float: right; margin-right: 10px; } .main-container_bg { width: 999px; float: left; ackground-color: #FFFFFF; } #main-container { width: 999px; margin: 0 auto; padding: 0; ackground: url(../images/home-page-body-bg.) no-repeat left top #FFFFFF; } body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #8a898a; background: url(../images/bg1.jpg) no-repeat center top #FFFFFF; } html, body { margin: 0; } input, textarea, select { font-family: "EurostileRegular"; font-size: 12px; color: #8a898a; } </style> </head> <body><form name="form1" id="form1" action="default.aspx" method="post"><div id="main-container"><div class="main-container_bg"><div id="right-wrap"><div class="block-1"><div class="list-box"><div class="menu_list" id="secondpane"><div class="menu_body" style="display: none;"><div class="form-box"><div id="UPPODImages"> <div class="row"> <p> Enter your consignment number to view POD image</p> </div> <div class="row"> <div class="fields"> Con No.</div> <input name="txtpodconno" class="input" id="txtpodconno" type="text"> </div> <div class="row"> <div class="submit"> <input name="btnpodsubmit" class="btn" id="btnpodsubmit" type="submit" value="Submit"></div> </div> </div></div></div></div></div></div></div></div></div></form></body> </html> Unquote
-
Hello Kickstarter15, Sorry for the delay reply, this is in VB script not Autoit, however i have tried your suggested code, this is not giving any output or result. Dim fso As Object Dim FromPath As String Dim ToPath As String Dim objFSO, objFolder, strFile FromPath = "C:\AR\" ToPath = "C:\AR1\" If fso.FolderExists(FromPath) = False Then MsgBox "File doesn't exist. Not found!" Exit Sub End If For Each strFile In objFolder.Files If objFSO.GetExtensionName(strFile.Name) = "xlsm" Then objFSO.CopyFile strFile.Path, ToPath End If Next
-
Hello Trying to add below code in my main script but this is not functioning can you advise what else i need to do? Dim fn As String Const myDir As String = "C:\AR\" '<- alter here Const newFolder As String = "C:\AR1\" '<- alter here fn = Dir(myDir & "AR_*.xlsm") Do While fn <> "" FileCopy myDir & fn, newFolder & Replace(fn, "AR", "AI") fn = Dir Loop
-
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, Please help on this -
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, I have attached manual report, i have changed actual customer name to XXX because don't want to disclose customer name AI-17.04.2017.xlsx -
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, Code and file attached $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open ("C:\AR\Deptwise AR-20.03.2017.xlsx") $test = $oExcel.ActiveWorkbook.PivotCaches.Create(1,"A1:Y11795",1) $oExcel.Sheets.Add $test2 = $oExcel.Range("A1") $oExcel.ActiveSheet.PivotTables.Add($test,$test2,"GCI") With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("GCI") .Orientation = 1 .Position = 1 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("Name") .Orientation = 1 .Position = 2 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("Credit limit") .Orientation = 1 .Position = 3 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("Balance") .Orientation = 1 .Position = 4 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("30 Days") .Orientation = 1 .Position = 5 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("31-45 Days") .Orientation = 1 .Position = 6 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("46-60 Days") .Orientation = 1 .Position = 7 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("61-90 Days") .Orientation = 1 .Position = 8 EndWith With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("91-120 Days") .Orientation = 1 .Position = 9 EndWith Deptwise AR-20.03.2017.xlsx -
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
-
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, yes, but when trying to add 2nd column am getting error, also there is no data displaying under GCI in pivot. $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open ("C:\AR\Deptwise AR-20.03.2017.xlsx") $test = $oExcel.ActiveWorkbook.PivotCaches.Create(1,"A1:Y11795",1) $oExcel.Sheets.Add $test2 = $oExcel.Range("A1") $oExcel.ActiveSheet.PivotTables.Add($test,$test2,"GCI") With $oExcel.ActiveSheet.PivotTables("GCI").PivotFields("GCI") .Orientation = 1 .Position = 1 EndWith With $oExcel.ActiveSheet.PivotTables("Name").PivotFields("Name") .Orientation = 1 .Position = 2 EndWith -
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Water, No, what i understand we just need to change syntax of recorded macros, so same thing i tried to do, but am getting error. -
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, I have created below script attached is the error. $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open ("C:\AR\Deptwise AR-20.03.2017.xlsx") $test = $oExcel.ActiveWorkbook.PivotCaches.Create(1,"A1:Y11795",1) $oExcel.Sheets.Add $test2 = $oExcel.Range("A1") $oExcel.ActiveSheet.PivotTables.Add($test,$test2,"GCI") With $oExcel.ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI") .Orientation = 1 .Position = 1 EndWith With $oExcel.ActiveSheet.PivotTables("PivotTable4").PivotFields("Name") .Orientation = 1 .Position = 2 EndWith Below complete Code copied from Macros recorder Sub Pivot1() ' ' Pivot1 Macro ' ' Keyboard Shortcut: Ctrl+Shift+A ' ActiveWindow.LargeScroll ToRight:=-1 Sheets.Add ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Sheet1!R1C1:R170C24", Version:=xlPivotTableVersion15).CreatePivotTable _ TableDestination:="Sheet2!R3C1", TableName:="PivotTable4", DefaultVersion _ :=xlPivotTableVersion15 Sheets("Sheet2").Select Cells(3, 1).Select With ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable4").PivotFields("Name") .Orientation = xlRowField .Position = 2 End With ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("Credit limit"), "Sum of Credit limit", xlSum With ActiveSheet.PivotTables("PivotTable4").PivotFields("Sum of Credit limit") .Caption = "Min of Credit limit" .Function = xlMin End With ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("Balance"), "Sum of Balance", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("30 Days"), "Sum of 30 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("31-45 Days"), "Sum of 31-45 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("46-60 Days"), "Sum of 46-60 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("61-90 Days"), "Sum of 61-90 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("91-120 Days"), "Sum of 91-120 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields(">120 Days"), "Sum of >120 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields(">60 Days"), "Sum of >60 Days", xlSum ActiveWorkbook.ShowPivotTableFieldList = False Range("J4").Select ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI").AutoSort xlDescending _ , "Sum of >60 Days", ActiveSheet.PivotTables("PivotTable4").PivotColumnAxis. _ PivotLines(9), 1 With ActiveSheet.PivotTables("PivotTable4") .InGridDropZones = True .DisplayFieldCaptions = False .RowAxisLayout xlTabularRow End With ActiveSheet.PivotTables("PivotTable4").PivotFields("Invoice").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Date").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("File").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Name").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Credit limit").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Balance").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("30 Days").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("31-45 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("46-60 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("61-90 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("91-120 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields(">120 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields(">60 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Days").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Ar Date").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Dept").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Branch").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Foreign Balance"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Foreign Currency"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("HBL").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("EDI Status").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Last EDI Status Date"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Last EDI Status Reason"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) Cells.Select Cells.EntireColumn.AutoFit Range("I10").Select ActiveWorkbook.Save End Sub -
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, Sorry i have replied to wrong thread, pls ignore that and consider this message only I have recorded the the Macros and applied same in my Autoit script after changing the syntax, but some how this is not working $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open ("C:\AR\Deptwise AR-20.03.2017.xlsx") $test = $oExcel.ActiveWorkbook.PivotCaches.Create(1,"A1:Y11795",1) $oExcel.Sheets.Add $test2 = $oExcel.Range("A1") $oExcel.ActiveSheet.PivotTables.Add($test,$test2,"GCI") With $oExcel.ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI") .Orientation = 1 .Position = 1 EndWith With $oExcel.ActiveSheet.PivotTables("PivotTable4").PivotFields("Name") .Orientation = 1 .Position = 2 EndWith ActiveWindow.LargeScroll ToRight:=-1 Sheets.Add ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Sheet1!R1C1:R170C24", Version:=xlPivotTableVersion15).CreatePivotTable _ TableDestination:="Sheet2!R3C1", TableName:="PivotTable4", DefaultVersion _ :=xlPivotTableVersion15 Sheets("Sheet2").Select Cells(3, 1).Select With ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable4").PivotFields("Name") .Orientation = xlRowField .Position = 2 End With ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("Credit limit"), "Sum of Credit limit", xlSum With ActiveSheet.PivotTables("PivotTable4").PivotFields("Sum of Credit limit") .Caption = "Min of Credit limit" .Function = xlMin End With ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("Balance"), "Sum of Balance", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("30 Days"), "Sum of 30 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("31-45 Days"), "Sum of 31-45 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("46-60 Days"), "Sum of 46-60 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("61-90 Days"), "Sum of 61-90 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields("91-120 Days"), "Sum of 91-120 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields(">120 Days"), "Sum of >120 Days", xlSum ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _ "PivotTable4").PivotFields(">60 Days"), "Sum of >60 Days", xlSum ActiveWorkbook.ShowPivotTableFieldList = False Range("J4").Select ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI").AutoSort xlDescending _ , "Sum of >60 Days", ActiveSheet.PivotTables("PivotTable4").PivotColumnAxis. _ PivotLines(9), 1 With ActiveSheet.PivotTables("PivotTable4") .InGridDropZones = True .DisplayFieldCaptions = False .RowAxisLayout xlTabularRow End With ActiveSheet.PivotTables("PivotTable4").PivotFields("Invoice").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Date").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("File").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("GCI").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Name").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Credit limit").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Balance").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("30 Days").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("31-45 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("46-60 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("61-90 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("91-120 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields(">120 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields(">60 Days").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Days").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Ar Date").Subtotals = Array _ (False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Dept").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Branch").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Foreign Balance"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Foreign Currency"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("HBL").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("EDI Status").Subtotals = _ Array(False, False, False, False, False, False, False, False, False, False, False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Last EDI Status Date"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) ActiveSheet.PivotTables("PivotTable4").PivotFields("Last EDI Status Reason"). _ Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _ False, False) Cells.Select Cells.EntireColumn.AutoFit Range("I10").Select ActiveWorkbook.Save End Sub -
Ignore this request
-
open excel and update pivot
sumandevadiga replied to PINTO1927's topic in AutoIt General Help and Support
Hello Juvigy, Thanks, if there are mutilple columns need to add in row field how orientation and position will work?