|
Помогите с переводом Макроса
|
|||
---|---|---|---|
#18+
Привет всем! Вот конкретный макрос. Помогите с правильным переводом в синтаксис Фокса (8.0) чтобы это макрос можно было запустить в программе. Sub BOMs_new() ' ' BOMs_new Ìàêðîñ ' BOMs_new ' ' Range("F4").Select Selection.Copy Range("E3").Select ActiveSheet.Paste Application.CutCopyMode = False With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _ "ODBC;Driver={Microsoft FoxPro VFP Driver (*.dbf)};UID=;PWD=;SourceDB=c:\Price_calc\annex;SourceType=DBF;Exclusive=No;BackgroundFetch" _ ), Array("=Yes;Collate=Machine;Null=Yes;Deleted=Yes;")), Destination:=Range( _ "F1")) .CommandText = Array( _ "SELECT annex_boms_o.n6" & Chr(13) & "" & Chr(10) & "FROM annex_boms_o annex_boms_o") .Name = "Çàïðîñ èç boms" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With Range("E3").Select Selection.Copy Range("F4").Select ActiveSheet.Paste Columns("G:G").Select Application.CutCopyMode = False Selection.Delete Shift:=xlToLeft Range("F1").Select ActiveCell.FormulaR1C1 = " " End Sub ... |
|||
:
Нравится:
Не нравится:
|
|||
23.03.2009, 17:46 |
|
Помогите с переводом Макроса
|
|||
---|---|---|---|
#18+
могу показать как подцепить макрос на лету и выполнить. т.е. макрос можно не переводить, а подготовить файл и запустить в нем макрос ... |
|||
:
Нравится:
Не нравится:
|
|||
23.03.2009, 17:53 |
|
Помогите с переводом Макроса
|
|||
---|---|---|---|
#18+
Может поможет FAQ ... |
|||
:
Нравится:
Не нравится:
|
|||
23.03.2009, 18:29 |
|
Помогите с переводом Макроса
|
|||
---|---|---|---|
#18+
прошелмимо, спасибо за отклик - я нашел решение : local loExcel, lcMacros text to lcMacros noshow pretext 3 Sub BOMs_n1() MsgBox (" Save Macros") Range("F3").Select Selection.Copy Range("E2").Select ActiveSheet.Paste Application.CutCopyMode = False With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _ "ODBC;Driver={Microsoft FoxPro VFP Driver (*.dbf)};UID=;PWD=;SourceDB=c:\np\annex;SourceType=DBF;Exclusive=No;BackgroundFetch" _ ), Array("=Yes;Collate=Machine;Null=Yes;Deleted=Yes;")), Destination:=Range( _ "F1")) .CommandText = Array( _ "SELECT cur_boms_o.n6" & Chr(13) & "" & Chr(10) & "FROM cur_boms_o cur_boms_o") .Name = "Çàïðîñ èç boms" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With Range("E2").Select Selection.Copy Range("F3").Select ActiveSheet.Paste Columns("G:G").Select Application.CutCopyMode = False Selection.Delete Shift:=xlToLeft Range("F1").Select ActiveCell.FormulaR1C1 = " " Range("E2").Select ActiveCell.FormulaR1C1 = " " End Sub endtext strtofile(lcMacros, "c:\np\Annex\Boms_n.bas") WAIT WINDOW " Please wait while inserting data to "+fl1+" Sometimes it whill take a few minutes..." nowait loExcel = CREATEOBJECT("Excel.Application") with loExcel .visible = .f. .Workbooks.Open("&fl1") .Sheets("&fl2").Select .ActiveWorkBook.VBProject.VBComponents.import ("c:\np\Annex\Boms_n.bas") .run("BOMs_n1") .visible = .t. endwith return просто небольшая загвоздка была в том, что исходный эксельник содержит свои макросы, ссылки на другие таблицы и т.п. - тоесть нельзя было просто ,,,, а с вышеприведенным вариантом 30 тыс строк заливает примерно 2,5 мин. ... |
|||
:
Нравится:
Не нравится:
|
|||
24.03.2009, 12:44 |
|
|
start [/forum/topic.php?fid=41&tid=1586638]: |
0ms |
get settings: |
9ms |
get forum list: |
12ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
50ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
41ms |
get tp. blocked users: |
2ms |
others: | 12ms |
total: | 149ms |
0 / 0 |