Имя: Пароль:
1C
 
запись в ексель из 1с
0 колодина
 
31.07.08
06:52
на компе установлены два екселя - 2003 и 2007. когда в 1С вызываю ексель -вызывается 2007. и записывает файл своего формата. как мне сделать, чтобы либо
- вызывался 2003 ексель
- либо записать файл с указанным форматом.
спасибо.
1 el-gamberro
 
31.07.08
06:55
У мну Excel.Application.11 - 2003
Excel.Application.8 - 97
2 el-gamberro
 
31.07.08
06:56
Excel.Application - 2003
3 колодина
 
31.07.08
06:59
(1) ну и чег описать? вызов так делать что ли?
4 колодина
 
31.07.08
06:59
в команде saveas вроде можно формат указать... вот только не могу найти - какой там параметр
5 el-gamberro
 
31.07.08
07:09
Workbook.SaveAs FileFormat := xlNormal

xlExcel2
xlExcel3
xlExcel4
xlExcel5
xlExcel7
xlExcel9795
6 колодина
 
31.07.08
07:15
екс.ActiveWorkBook.saveas(имякаталога + "\" + имяФайла); - где писать формат,а?
7 el-gamberro
 
31.07.08
07:16
.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
8 колодина
 
31.07.08
07:19
(7) аха... если я верно понимаю - xlnormal - записывает в своем формате...
9 big
 
31.07.08
07:24
(6) Лена, неужели Ф1 не работает? :)
10 el-gamberro
 
31.07.08
07:24
(8) да
11 колодина
 
31.07.08
07:26
ошибку выдает....
   екс.ActiveWorkBook.saveas(имякаталога + "\" + имяФайла,"xlExcel9795");
12 колодина
 
31.07.08
07:26
(9) ну если такой умный - то напиши каким образом записать в нужном формате... вот у меня - не выходит к сожалению...
13 big
 
31.07.08
07:29
(12) Не сердись и не ругайся, пожалуйста :)  Просто у меня ни офиса ни ОО не установлено. Константу xlExcel9795 надо числом писАть.
14 колодина
 
31.07.08
07:31
(13) а я не ругаюсь совсем.... это ты пальцы гнешь в (9)... и каким числом писать? типа - это все знают?
15 big
 
31.07.08
07:33
(14) Извини, не хотел обидеть, чесс слово. :)

В справке есть числовые значения всех констант Екселя, поищи, пожалуйста. Я на память не помню.
16 el-gamberro
 
31.07.08
07:36
В редакторе VB запусти Object Browser
В поиске FileFormat там и будут значения констант
Const xlExcel9795 = 43
17 колодина
 
31.07.08
07:46
екс.ActiveWorkBook.saveas(имякаталога + "\" + имяФайла ,43);
метод завершен неверно....
18 dk
 
31.07.08
08:03
(17) В 2007 поменяли объектную модель :(
т.е. некоторые макросы 2003 не будут работать в 2007 и наоборот :(
Может ну его нафиг Ехель 2007? Снести
---
Скопируй сюда справку VBA по saveas для Workbook из 2007. Или справку по VBA не поставила?
19 колодина
 
31.07.08
08:05
да у меня 2007 не стоит... у юзера стоит.
снести - не решение...
20 колодина
 
31.07.08
08:06
вот в 2007 - вообще не нашла где можно справку посмотреть по VBA
21 big
 
31.07.08
08:09
FileFormat только для чтения, вроде бы получается...

Это из справки.

FileFormat Property
See AlsoApplies ToExampleSpecificsReturns the file format and/or type of the workbook. Read-only XlFileFormat.

expression.FileFormat
expression    Required. An expression that returns one of the objects in the Applies To list.
22 big
 
31.07.08
08:11
(18)



SaveAs Method
See AlsoApplies ToExampleSpecificsSaveAs method as it applies to the Chart and Worksheet objects.

Saves changes to the chart or worksheet in a different file.

expression.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AddToMru, TextCodepage, TextVisualLayout, Local)
expression    Required. An expression that returns one of the above objects.

Filename    Optional Variant. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.

FileFormat    Optional Variant. The file format to use when you save the file. For a list of valid choices, see the FileFormat property. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.

Password    Optional Variant. A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.

WriteResPassword    Optional Variant. A string that indicates the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened as read-only.

ReadOnlyRecommended    Optional Variant. True to display a message when the file is opened, recommending that the file be opened as read-only.

CreateBackup    Optional Variant. True to create a backup file.

AddToMru    Optional Variant. True to add this workbook to the list of recently used files. The default value is False.

TextCodePage    Optional Variant. Not used in U.S. English Microsoft Excel.

TextVisualLayout    Optional Variant. Not used in U.S. English Microsoft Excel.

Local   Optional Variant. True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).

SaveAs method as it applies to the Workbook object.

Saves changes to the workbook in a different file.

expression.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
expression    Required. An expression that returns one of the above objects.

Filename    Optional Variant. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Microsoft Excel saves the file in the current folder.

FileFormat    Optional Variant. The file format to use when you save the file. For a list of valid choices, see the FileFormat property. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.

Password    Optional Variant. A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.

WriteResPassword    Optional Variant. A string that indicates the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened as read-only.

ReadOnlyRecommended    Optional Variant. True to display a message when the file is opened, recommending that the file be opened as read-only.

CreateBackup    Optional Variant. True to create a backup file.

AccessMode   Optional XlSaveAsAccessMode.

XlSaveAsAccessMode can be one of these XlSaveAsAccessMode constants.
xlExclusive (exclusive mode)
xlNoChange default (don't change the access mode)
xlShared (share list)
If this argument is omitted, the access mode isn't changed. This argument is ignored if you save a shared list without changing the file name. To change the access mode, use the ExclusiveAccess method.


ConflictResolution    Optional XlSaveConflictResolution.

XlSaveConflictResolution can be one of these XlSaveConflictResolution constants.
xlUserResolution (display the conflict-resolution dialog box)
xlLocalSessionChanges (automatically accept the local user's changes)
xlOtherSessionChanges (accept other changes instead of the local user's changes)
If this argument is omitted, the conflict-resolution dialog box is displayed.


AddToMru    Optional Variant. True to add this workbook to the list of recently used files. The default value is False.

TextCodePage    Optional Variant. Not used in U.S. English Microsoft Excel.

TextVisualLayout    Optional Variant. Not used in U.S. English Microsoft Excel.

Local   Optional Variant. True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).

Example
This example creates a new workbook, prompts the user for a file name, and then saves the workbook.

Set NewBook = Workbooks.Add
Do
   fName = Application.GetSaveAsFilename
Loop Until fName <> False
NewBook.SaveAs Filename:=fName
23 колодина
 
31.07.08
08:12
нашла в 2007... самое забавное - тоже 43 этот формат
24 dk
 
31.07.08
08:12
(20) Открываешь Ехель, Ворд, ...
Ctrl + F11
Help - Справка по VBA
---
ндяя
25 колодина
 
31.07.08
08:14
ну вот что делать - непонятно....
26 dk
 
31.07.08
08:14
(22) Вроде те же параметры. Это 2007?
Тогда может имя файла
27 колодина
 
31.07.08
08:15
(24) да посмотрела уже... в этом 2007 - сам черт ногу сломит... ну крутые вы ребята - даже меряться с вами не стану... скажите как в 2007 записать файл в нужном мне формате - и красуйтесь дальше...
28 big
 
31.07.08
08:22
а если так

ActiveWorkBook.FileFormat = 43
ActiveWorkBook.SaveAs(ИмяФайла)


з.ы. а имя файла "нормальное"?
29 smaharbA
 
31.07.08
08:25
30 колодина
 
31.07.08
08:27
(28) нормальное имя файла... без форматов - все записывается...
31 big
 
31.07.08
08:29
(29) ЖЖОШЬ кучерявый :))
(30) а как в (28) пробовала?
32 колодина
 
31.07.08
08:29
екс.ActiveWorkBook.fileformat=43;
{Обработка.ФормированиеФормЕксель.Форма.Модуль(159)}: Microsoft Office Excel: Нельзя установить свойство FileFormat класса Workbook
33 dk
 
31.07.08
08:33
попробуй формат
xlExcel8 = 56 (&H38)
34 dk
 
31.07.08
08:37
соответственно (чуть пальцы не поломал)

екс.ActiveWorkBook.saveas(имякаталога + "\" + имяФайла , 56);
35 smaharbA
 
31.07.08
08:36
(32) а его только зырить можно
36 big
 
31.07.08
08:40
(35) м.б. не делать конкатенацию при вызове метода, а?

ПолноеИмя=имякаталога + "\" + имяФайла;
екс.ActiveWorkBook.saveas(ПолноеИмя, 56);
37 smaharbA
 
31.07.08
08:41
Елена Вы ьы хоть кусочек кода дали на съедение
38 dk
 
31.07.08
08:42
(32) крут? уже могу дальше красоваться? :)
39 Bww_
 
31.07.08
08:43
Честно говоря 2007 до сих пор не пользовал.
Может попробовать «Сервис->Макрос->Начать запись», а там посмотреть, как он (excel2007) «опишет» в VBA запись файла в нужном формате
40 dk
 
31.07.08
08:45
(39) именно так и сделал :) см. (33)
Блин, заколебался искать запись макроса. (29) спасибо
41 колодина
 
31.07.08
08:47
екс.ActiveWorkBook.saveas(имякаталога + "\" + имяФайла , 56);

проработала...
(40) спасибо добрый человек... можешь красоваться дальше....
42 smaharbA
 
31.07.08
08:47
и еще - непонятно как коррелирует сабж с форматом сохранения ?
43 колодина
 
31.07.08
08:48
(37) а чего код то? важна только одна строка на самом деле...
44 big
 
31.07.08
08:50
(40) в макросе помимо формата файла ещё много чего прописано. ИМХО попробовать и это указать?

Sub Проба()
'
' Проба Макрос
' Макрос записан 31.07.2008
'
'
   ActiveWorkbook.SaveAs Filename:= _
       "C:\Documents and Settings\Администратор\Мои документы\Книга2.xls", FileFormat _
       :=xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
       False, CreateBackup:=False
End Sub
45 el-gamberro
 
31.07.08
08:52
(44) там остальные параметры необязательные
46 dk
 
31.07.08
08:53
(44) точно в 2007 работаешь?
47 smaharbA
 
31.07.08
08:53
(43) про Машу и касло анекдот знаешь ?