Tecnologia, programação e muito Visual FoxPro.

terça-feira, 18 de janeiro de 2011

]] XL-mania [[ Merubah tanggal pada macro

 

Dear pakar excel,
Kami punya record macro excel seperti ini;
Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+m
'

With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"ODBC;DSN=Report Bulanan;UID=cms;;APP=2007 Microsoft Office system;WSID=URIP;DATABASE=MIGRASI" _
, Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT SALES.LOCID, SALES.STATUS, SALES.INVOICE_DATE, SALES.INVOICE_NO, SALES.SERVICE_ORDER, SALES.CUSTOMER_TYPE, SALES.REPAIR_TYPE, SALES.CUSTOMER_CODE, SALES.LABOR, SALES.PART, SALES.OIL, SALES.MATE" _
, _
"RIAL, SALES.SUBLET, SALES.DISCOUNT, SALES.TURN_OVER, SALES.TAX, SALES.METERAI, SALES.TOTAL, SALES.DIFFERENT, SALES.POLICE_NO, SALES.CUSTOMER, SALES.ADDRESS, SALES.CITY, SALES.TAX_NO, SALES.TAX_DATE, S" _
, _
"ALES.TRANS_DATE, SALES.NPWP, SALES.RATE, SALES.MODEL" & Chr(13) & "" & Chr(10) & "FROM MIGRASI.dbo.SALES SALES" & Chr(13) & "" & Chr(10) & _
"WHERE (SALES.INVOICE_DATE>={ts '2010-07-01 00:00:00'} And SALES.INVOICE_DATE<={ts '2010-07-10 00:00:00'})" _
)
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table_Query_from_Report_Bulanan_1"
.Refresh BackgroundQuery:=False
End With
End Sub

Record macro diatas dipergunakan setiap kali kami melakukan penarikan data dari server kami, kesulitannya adalah user selalu melakukan penggantian tanggal pada record macro diatas
("WHERE (SALES.INVOICE_DATE>={ts '2010-07-01 00:00:00'} And SALES.INVOICE_DATE<={ts '2010-07-10 00:00:00'})")
setiap saat sesuai range data yg dibutuhkan, apakah ada jalan pembuatan semacam sortcut agar user tidak perlu membuka visualbasic nya dan tanggal bisa diubah,
Terima kasih atas bantuannya

__._,_.___
Recent Activity:
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| "if you are the most valuable assets, you will show up on the     |
| balance sheet..." - oNo Wiqe                                      |
| http://www.facebook.com/group.php?gid=37671048001&ref=mf          |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message,  melecehkan,  tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan  winzip  jika  perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke  |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/           |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau...  |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html           |
+-------------------------------------------------------------------+
| Message lama ada di :                                             |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id]  |
| http://www.mail-archive.com/xl-mania@yahoogroups.com              |
+-------------------------------------------------------------------+
.

__,_._,___

Nenhum comentário:

Arquivo do blog