R
romanko
Подскажите в чем проблема?Есть код для импорта из экселя в лотус, о при добавлении его в кнопку он пишет ошибка :"Указанная команда не доступна с рабочей области" Как с этим бороться?????
Sub Click(Source As Button)
Dim xlFilename As String
xlFilename = Inputbox$("1231.xls", "D:\Lotus\Справочник\1231.xls", "D:\Lotus\Справочник\1231.xls")
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Dim row As Integer
Dim written As Integer
Dim Excel As Variant
Dim xlWorkbook As Variant
Dim xlSheet As Variant
Dim xlCells As Variant
Set Excel = CreateObject("excel.application")
Excel.Visible = False
Print "Открыт файл " & xlFilename & "..."
Excel.Workbooks.Open xlFilename '// открытие файла Excel
Set xlWorkbook = Excel.ActiveWorkbook
Set xlSheet = xlWorkbook.ActiveSheet
Set xlCells = xlSheet.Cells
Print "Starting import from Excel file..."
Dim strName As String
Add:
Set doc = db.CreateDocument
With doc
.Form = "станции наме шорт"
.Namestan = xlCells( 2, 1).Value
.ShortName = xlCells( 2, 2).Value
End With
Call doc.Save( True, True )
excel.quit
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
Call ws.EditDocument( doc )
End Sub
Sub Click(Source As Button)
Dim xlFilename As String
xlFilename = Inputbox$("1231.xls", "D:\Lotus\Справочник\1231.xls", "D:\Lotus\Справочник\1231.xls")
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Dim row As Integer
Dim written As Integer
Dim Excel As Variant
Dim xlWorkbook As Variant
Dim xlSheet As Variant
Dim xlCells As Variant
Set Excel = CreateObject("excel.application")
Excel.Visible = False
Print "Открыт файл " & xlFilename & "..."
Excel.Workbooks.Open xlFilename '// открытие файла Excel
Set xlWorkbook = Excel.ActiveWorkbook
Set xlSheet = xlWorkbook.ActiveSheet
Set xlCells = xlSheet.Cells
Print "Starting import from Excel file..."
Dim strName As String
Add:
Set doc = db.CreateDocument
With doc
.Form = "станции наме шорт"
.Namestan = xlCells( 2, 1).Value
.ShortName = xlCells( 2, 2).Value
End With
Call doc.Save( True, True )
excel.quit
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
Call ws.EditDocument( doc )
End Sub