Ошибка получения объекта com 2147417846 0x8001010a

Похоже, вы не установили Option Explicit — поместите его в первую строку, и это поможет вам избежать ошибок. (С его помощью компилятор заставит вас объявить все ваши переменные. Это также будет означать, что когда вы его вставите, ваш код не будет работать, если вы не объявите все переменные.)


Первая проблема:

Set xlApp = CreateObject("Excel.Application")

Set MyXL = GetObject(, "Excel.Application")

Сначала вы создаете новый экземпляр Excel с CreateObject и сохраняете ссылку на него в xlApp (который впоследствии не используете). Затем вы пытаетесь получить ссылку на экземпляр существующий Excel с помощью GetObject и сохранить его ссылку в MyXL. Это работает надежно только потому, что вы сначала создаете новый экземпляр. В противном случае вы не могли бы гарантировать, что экземпляр Excel всегда доступен.

Связанная проблема заключается в том, что вы не отпускаете / не закрываете эти экземпляры. Если вы создаете экземпляр Excel, вам необходимо закрыть его с помощью xlApp.Quit после того, как вы закончите его использовать, иначе он будет задерживаться.
Однако будьте осторожны с экземплярами, которые вы переняли с GetObject — вызов MyXL.Quit закроет экземпляр независимо от того, какие другие книги открыты в это время.

Точно так же, если вы открываете файл таким образом, вам нужно обязательно закрыть его после этого. В противном случае вы столкнетесь с проблемой, с которой столкнетесь: Запишите защищенные файлы.


Итак, чтобы решить вашу проблему: закройте все открытые экземпляры Excel (лучше всего через диспетчер задач, так как некоторые из них могут быть невидимы). Затем настройте свой код, чтобы использовать только одну ссылку на Excel.Application. И, наконец, не забудьте записать книгу в .Close после сохранения, а в .Quit — свой экземпляр Excel. Надеюсь, это предотвратит повторное появление ошибки.

'Dim xlApp As Excel.Application    ' early-bound declaration
'Set xlApp = New Excel.Application    ' early-bound assignment
Dim xlApp As Object    ' late-bound declaration
Set xlApp = CreateObject("Excel.Application")    ' late-bound assignment

'Dim wb As Workbook    ' early-bound declaration
Dim wb as Object
Set wb = xlApp.Workbooks.Open(FPath)

' stuff you want to do with the workbook

wb.Close SaveChanges:=True
xlApp.Quit

Если вы можете добавить ссылку на объектную модель Excel в свой проект Catia VBA (не уверен в этом), вы можете закомментировать строки с поздней привязкой и вместо этого использовать строки с ранней привязкой. Таким образом вы получите очень полезный IntelliSense для объектов Excel. Это значительно упрощает программирование.

Detailed Error Information

RPC_E_SERVERCALL_RETRYLATER[1]

Message The message filter indicated that the application is busy.
Declared in winerror.h

HRESULT analysis[2]

Flags Severity Failure
Reserved (R) false
Origin Microsoft
NTSTATUS false
Reserved (X) false
Facility Code 1 (0x001)
Name FACILITY_RPC[2][1]
Description The source of the error code is an RPC subsystem.[2][1]
Error Code 266 (0x010a)

Questions

how to resolve The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

PowerPoint.Application PowerPoint_App; PowerPoint_App = new PowerPoint.ApplicationClass(); PowerPoint_App.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsNone; PowerPoint.Presentation presentation; presentation = null; try { PowerPoint_App.Visible = MsoTriState.msoTrue; presentation = PowerPoint_App.Presentations.Open(strPptFilePath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse); PowerPoint.Slide tempSlide = null; int totalSlides = presentation.Slides.Count; int slideNo = 0; I am getting the below exception on PowerPoint_App.Presentations.Open code. > Exception Message: The […] read more

Using Interop Library for Web Server Side Excel Creation

I am trying to create excel files using interop library, but below is the error I get: Creating an instance of the COM component with CLSID {00024500-0000-0000- C000-000000000046} from the IClassFactory failed due to the following error: 8001010a The message filter indicated that the application is busy. (Exception from HRESULT: […] read more

System.UnauthorizedAccessException only using multithreading

I wrote a code to parse some Web tables. I get some web tables into an IHTMLElementCollection using Internet Explorer with this code: TabWeb = IE.document.getelementsbytagname(«table») Then I use a sub who gets an object containing the IHTMLElementCollection and some other data: Private Sub TblParsing(ByVal ArrVal() As Object) Dim WTab […] read more

DCOM Config settings for Microsoft Interop Word Automation

I am using Microsoft Office Interop Word to generate documents using C#. In order for the document generation to work, there should be an entry for the «Microsoft Office Word 97 — 2003 Document» under the Dcom Config Settings as shown below: enter image description here [https://i.stack.imgur.com/fDrld.jpg] The Local Path […] read more

Why parallelized code will not write in an Excel spreadsheet?

Writing many worksheets in an Excel spreadsheet can take a while. Parallelizing it would be helpful. This code works well, it makes an Excel spreadsheet pop on the screen with four worksheets named Sheet1,1, 2, and 3. open Microsoft.Office.Interop.Excel open FSharp.Collections.ParallelSeq let backtestWorksheets = [1..3] let app = new ApplicationClass(Visible […] read more

Processing large Excel files using multiple threads

I am using c# VSTO and Interop lib for developing excel add-in. for validating each cell’s value before pasting these values into another workbook with formatting. My actual query is to process, (in fastest possible way) cells with some criteria. I have used WorkSheet.Cells.SpecialCells() for getting Excel.Range objects of my […] read more

Windows Anniversary Update (1607) & ComException

I have an application (C#) which uses ComInterop to manipulate and print documents from a 3rd Party App (Corel Draw x8). After Updating to Windows 1607 (Anniversary Update), things stop working immediately with creating my object (cdr = new CorelDRAW.Application();), or with the next line (hiding CorelDraw’s window) with an […] read more

Excel file operations using interop in multithreaded C# application fails

I’ve an application that automates some file related jobs. Every job is executed inside separate threads. One kind of job is exporting an Excel file to HTML format. I use Microsoft.Office.Interop.Excel namespace for this purpose. My application was working fine under Windows Server 2008 environment but we upgraded our server […] read more

Excel Interop Apply Chart Template

Problem Overview: I am automating the report generation (excel) for a customer using C# with «native» excel support (microsoft.office.interop.excel) and the EPPlus library. My customer is not very flexible about charts design so my charts must have the exact same style as theirs. No problem, i exported their chart templates […] read more

«Cannot find file» error during T4 template compilation

I’ve customized a T4 template in Visual Studio 2012, and while building I’m getting the following error message: Error 54 Running transformation: System.Runtime.InteropServices.COMException (0x80004005): Cannot find file «E:xxxyyyzzzSqliteSqliteUser.cs». Server stack trace: at EnvDTE.ProjectItems.AddFromFile(String FileName) at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.ProjectSync(ProjectItem templateProjectItem, IEnumerable`1 keepFileNames) at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.<.ctor>b__6a(IEnumerable`1 keepFileNames) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& […] read more

Trapping COM exception in F#

I have some F# code that calls a method on a COM Automation object. Sometimes that COM object throws an exception. I tried wrapping the calls to the COM object in a try…with block: try do some COM stuff with _ -> Printf.printf «got an exnrn» But the exception-handling code […] read more

Excel DNA resize return array vertically

I am trying to return dynamic array with help of Excel-DNA api. I am able to produce desired output. But I want to produce output in vertical . here is the c# code for my UDF. i have used this link for producing my sample. http://excel-dna.net/2011/01/30/resizing-excel-udf-result-arrays/ Below code produces this […] read more

Exception for powerpoint Interop while reading slides

I have a block of code which reads powerpoint slides and creates xml for them.Everything is working fine on my local machine.but on server,when second slide is read.I Get the exception: EXCEPTION:The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)) for Powerpoint Interop Function Throwing […] read more

VSTO Cancel Workbook Open event by sending Keystroke

When a large file (lets say a csv file greater than 50MB) is opened in Microsoft Excel, it opens with a little progress bar in the bottom right corner of the screen and it says «Press ESC to cancel». If you press the ESC key while the file is opening, […] read more

Error:-(Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

I am getting the following error while debugging my Windows Form Application for generating an excel sheet: Application is Busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)). I have gone thoroughly through the code and have not found any errors. An internet search suggests the problem is in Microsoft.Office.Interop.dll. How can I […] read more

Get all projects fron solution throws error

I am in debugging, I got the reference to current solution as DTE2. (as from «adabyron») I often got the following error when I tried foreach loop on vsSolution.Projects: > The message filter indicated that the application is busy. (Exception from > HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)) Click continue, I can still […] read more

Can sort the Excel tables in multi-thread?

My codes as follow: Parallel.ForEach(listSheets, (xlWorkSheet1) => { // Excel.Worksheet xlWorkSheet1 = (Excel.Worksheet)excelbk.Worksheets[«Sheet1»]; xlRange = (Excel.Range)xlWorkSheet1.Cells[xlWorkSheet1.Rows.Count, 1]; lock (xlRange) { // nRows = (long)xlRange.get_End(Excel.XlDirection.xlUp).Row; nRows = xlWorkSheet1.UsedRange.Cells.Rows.Count; xlRange = (Excel.Range)xlWorkSheet1.Rows[«5:» + nRows, Type.Missing]; xlRange.Sort(xlRange.Columns[clnum1, Type.Missing], Excel.XlSortOrder.xlAscending, xlRange.Columns[clnum2, Type.Missing], Type.Missing, Excel.XlSortOrder.xlAscending, Type.Missing, Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlNo, Type.Missing, Type.Missing, Excel.XlSortOrientation.xlSortColumns, Excel.XlSortMethod.xlStroke, Excel.XlSortDataOption.xlSortTextAsNumbers, Excel.XlSortDataOption.xlSortNormal, Excel.XlSortDataOption.xlSortNormal); […] read more

RPC_E_SERVERCALL_RETRYLATER during powershell automation

I’m using PowersHell to automate iTunes but find the error handling / waiting for com objects handling to be less than optimal. Example code #Cause an RPC error $iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibrarySource # Get «playlist» objects for main sections foreach ($PList in $LibrarySource.Playlists) { if($Plist.name -eq […] read more

GetIDsOfNames always fails with RPC_E_SERVERCALL_RETRYLATER for getting a property ID in Photoshop

I wrote the following C++ code, trying to perform some OLE automation tasks for currently-running Photoshop: IUnknown* unk = NULL; IDispatch* disp = NULL; CLSID clsId; if (FAILED(CLSIDFromProgID(L»Photoshop.Application», &clsId))) goto err; puts(«CLSIDFromProgID succeeded»); if (FAILED(GetActiveObject(&clsId, NULL, &unk))) goto err; puts(«GetActiveObject succeeded»); if (FAILED(IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp))) goto err; puts(«QueryInterface succeeded»); DISPID […] read more

How to reliably add projects to solution programmatically

The key word here is «reliably». When I create solution and add few projects I will get an exception: Unhandled Exception: System.Runtime.InteropServices.COMException: The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)) at EnvDTE.Project.get_Object() As ugly hack I added Thread.Sleep to avoid timeouts and this works, […] read more

In Excel Interop.Excel why would PivotField.ShowDetail = false throws exception?

I have a code which tries to Collapse Entire Field. At the very beginning of the foreach loop (with Worksheet), it crashes stating > Exception thrown: ‘System.Runtime.InteropServices.COMException’ in > CSVDiffUtility.exe > > Additional information: The message filter indicated that the application is > busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)) Did […] read more

Excel automation in windows service

I just finished with excel automation on my windows console application and it works. Now i want to move it to windows service, but i faced an error, which dont kno how to solve. When i run my application i get this error in my log file: System.Runtime.InteropServices.COMException (0x8001010A): The […] read more

Starting a new Outlook 2007 Message from C# .NET

I’m looking for the most barebones complete example, to launch Outlook 2007 with a new message started via C# .NET (I happen to be using VS2008 .NET 3.0) Here’s what I’m trying: using System; using System.Collections.Generic; using System.Text; using Microsoft.Office.Interop.Outlook; namespace CreateMessage { class Program { static void Main ( […] read more

WMPLib Console app exception on media play

I am not used to using InteropServices but what I am doing is using WMPLib to play songs from a console application. The application works as expected when I debug it from Visual Studio. But it crashes and gives me the following exception: Unhandled Exception: System.Runtime.InteropServices.COMException: The message filter indicated […] read more

Exporting Data to Word Doc using IIS on Windows Server 2008 R2 fails

> Creating an instance of the COM component with CLSID > {00020906-0000-0000-C000-000000000046} from the IClassFactory failed due to > the following error: 8001010a The message filter indicated that the > application is busy. (Exception from HRESULT: 0x8001010A > (RPC_E_SERVERCALL_RETRYLATER)). I get the above error message on my Windows 2008 Server […] read more

Trying fetch data from word document?

i am trying fetch data from word document using string Mainer(string pathfile) { Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); object miss = System.Reflection.Missing.Value; object path = pathfile; object readOnly = true; Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref […] read more

The message filter indicated that the application is busy

When I try to read content of word doc by oWordDoc.Content, It throws exception: > The message filter indicated that the application is busy. (Exception from > HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)) I tried OApplication.Visible = false, It also did not work. read more

Error automating Word on Test Server

I am trying to open a Word document from a .Net web application. The code (in brief) contains … using Word = Microsoft.Office.Interop.Word; using System.Reflection; and, the code that actually creates the document includes: object oMissing = System.Reflection.Missing.Value; object oEndOfDoc = «\endofdoc»; // endofdoc is a predefined bookmark object oTemplate […] read more

Running Word from a SharePoint Workflow

based on Join MS Word documents I have made a console application that splices multiple word files into one. Now I want to do the same from a Workflow in SharePoint. In short, my code before it fails looks like this: object oMissing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.ApplicationClass oWord = new Microsoft.Office.Interop.Word.ApplicationClass(); […] read more

Comments

Leave a comment

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0

  • Remove From My Forums
  • General discussion

  • Hi, powerful experts!

    I have a problem on a personal matter.

    I’m coding the project using by VSTO, VB.Net.

    The project is the excel spreadsheet code behind document.

    The code is to search about the 20000 cells and to get all different values.

    I completed the code, but I’ve encounted the error running.

    The error is following.

    System.Runtime.InteropServices.COMException   {«The message filter indicated that the application is busy.

          (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))»} 

    ErrorCode: -2147417846

    Message: «The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))»

    If anyone know to resolve this error, please answer.

    Best Regards.

    Jinjinfuture

  1. На главную

  2. How

  3. как решить Фильтр сообщений указал, что приложение занято. (Исключение из HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
  • 2023
  • Редактор:
    Christopher Sullivan |
    Написать мне


Я получаю следующее исключение для кода .

Сообщение об исключении: Фильтр сообщений показал, что приложение занято. (Исключение из HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))

Ранее я не получал эту ошибку в этом блоке кода. Раньше все работало отлично. Кто-нибудь может помочь?

  • 1 В этой ветке есть ценная информационная ссылка. У меня была аналогичная проблема, и добавление сна помогло.

В итоге я удалил:


И это сработало … !!!

  • из любопытства — вы пытались поменять строчки местами? Таким образом, вы делаете приложение видимым ПОСЛЕ открытия презентации …
  • @ Ахмедильяс: я этого не пробовал. Однако, как я уже сказал, раньше работал тот же код.
  • 8 Офисное приложение (powerpoint) может просто показывать какое-то сообщение (например, сообщение о повторной активации, новости или любое другое сообщение, которое оно может показывать при запуске) и ждет, когда вы нажмете на него .. «DisplayAlerts = «Нет» не блокирует их. Иногда это является причиной этой ошибки. Попробуйте просто запустить PowerPoint вручную, чтобы проверить, не появляется ли всплывающее сообщение при запуске.
  • 1 Как бы то ни было, я также обнаружил, что мне не удалось получить COM-объект при выполнении моего процесса как запланированной задачи. Однако запуск его как стандартного приложения, похоже, помог.

Я работаю над аналогичной проблемой (управление Excel через PowerShell) и хотел добавить, что — в способе, которым я не могу начать объяснять — аналог предложения @Milind Anantwar заставил мой скрипт начать работать.

Подробнее, если они помогут:

  • В моем случае при локальном запуске все работало нормально. Я начал видеть

    Приложение занято

    исключение только тогда, когда я перешел к выполнению через Azure Hybrid Worker Runner.

  • Что касается следующего фрагмента, я видел исключение после строка 2, но удаление строки 2 «устранило» проблему:

    
    
  • Я видел исключение, когда было установлено на .

  • Я только что столкнулся с той же проблемой, что и OP, использующий Perl-модуль Win32 :: OLE для чтения файлов Excel. В примере, над которым я работал, была строка . Комментируя это, я решил проблему.

Проверьте свой диспетчер задач; у вас может быть потерянный экземпляр приложения из сеанса отладки. Убейте его и попробуйте еще раз. Так было со мной раньше.

   evorle145

18.09.15 — 15:39

Помогите, чет совсем в ступоре. База клиент-серверная.

&НаКлиенте

Процедура СоздатьПечатнуюФормуДоговора(Команда)

Макет = ПолучитьМакетСервер(); //серверная функция, записывает макет в файл и возвращает полное имя файла  

        Попытка        

            КомОбъект = ПолучитьCOMОбъект(Макет); //инициализируем COM-объект

        Исключение

            КомОбъект = 0;

            Сообщение = Новый СообщениеПользователю;

            Сообщение.Текст = ОписаниеОшибки();

            Сообщение.Сообщить();

            
        КонецПопытки;

Падает в исключение!

Функция ПолучитьМакетСервер(КомОбъект)

    Об = РеквизитФормыВЗначение(«Объект»);

    Макет = Об.ПолучитьМакет(«Макет»);  

    ИмяФайла = ПолучитьИмяВременногоФайла(«doc»);

    Макет.Записать(ИмяФайла);

        
    Возврат ИмяФайла;

    
КонецФункции

Где туплю, подскажите?

   ВедущийП

1 — 18.09.15 — 15:41

Текст ошибки?

   evorle145

2 — 18.09.15 — 15:42

{Справочник.ДоговорыКонтрагентов.Форма.ФормаЭлемента.Форма(1010)}: Ошибка при вызове метода контекста (ПолучитьCOMОбъект): Ошибка получения объекта COM: -2147221020(0x800401E4): Синтаксическая ошибка

   evorle145

3 — 18.09.15 — 15:44

(1) , забыл уточнить, в файлом варианте все работает!

   Записьдампа

4 — 18.09.15 — 15:45

(0) Файловые системы на клиенте и сервере — очень разные вещи. Начиная от расположения файлов и кончая правами доступа.

   evorle145

5 — 18.09.15 — 15:47

(4) , понимаю. Но ведь тут сделано все вроде по инструкции как http://catalog.mista.ru/public/270277/ . Но com объект на клиенте создать не может…

   ВедущийП

6 — 18.09.15 — 15:51

Windows 32 разрядный?

   evorle145

7 — 18.09.15 — 15:52

(6) не, 64

   Записьдампа

8 — 18.09.15 — 15:56

(5) Это к автору писульки на нимфостарте, плз. Ты сохраняешь файл по пути для сервера, а потом пытаешся читать его на клиенте. А это возможно только в файловой базе или в случае когда сервер запущен на той же машине.

   evorle145

9 — 18.09.15 — 15:58

(8) , так а как же тогда? читать тоже на сервере что ли?

   Записьдампа

10 — 18.09.15 — 16:03

(9) Передавать тушку файла, из которого ты создаешь комобъект, через временное хранилище.

   Serginio1

11 — 18.09.15 — 16:03

Возвращай Двоичные Данные и записывай на клиенте в папки на которые есть разрешения в Ворде итд.

   ВедущийП

12 — 18.09.15 — 16:06

(5) Сохраняй файл в общей папке, и отдавай путь типа \serversharefail.doc

   ВедущийП

13 — 18.09.15 — 16:09

Функция ПолучитьМакетСервер(КомОбъект)

    Об = РеквизитФормыВЗначение(«Объект»);

    Макет = Об.ПолучитьМакет(«Макет»);  

    ИмяФайла = ПолучитьИмяВременногоФайла(«doc»);

    СтрЗаменить(ИмяФайла, КаталогВременныхФайлов(), «\servershare»);

Макет.Записать(ИмяФайла);

        
    Возврат ИмяФайла;

    
КонецФункции

   ВедущийП

14 — 18.09.15 — 16:09

Ессесно надо добавить ИмяФайла=

ИмяФайла = СтрЗаменить(ИмяФайла, КаталогВременныхФайлов(), «\servershare»);

   ВедущийП

15 — 18.09.15 — 16:10

В папку должен доступ иметь пользователь под которым запущен сервер 1С

   evorle145

16 — 18.09.15 — 16:11

(13) , то есть проблема в том , что на клиенте я не могу обратиться к файлу, у которого путь такой: C:UsersUSR1CV82AppDataLocalTemp  ?

   evorle145

17 — 18.09.15 — 16:16

(11)  это то есть так делать:

&НаСервере

Функция ПолучитьМакетСервер(АдресФайлаВХранилище)

    Об = РеквизитФормыВЗначение(«Объект»);

    Макет = Об.ПолучитьМакет(«Макет»);  

    ИмяФайла = ПолучитьИмяВременногоФайла(«doc»);

    Макет.Записать(ИмяФайла);

    ДвоичныеДанные = Новый ДвоичныеДанные(ИмяФайла);

    АдресФайлаВХранилище = ПоместитьВоВременноеХранилище(ДвоичныеДанные);

    Возврат ИмяФайла;

КонецФункции

И потом на клиенте

ДвоичныеДанные = ПолучитьИзВременногоХранилища(АдресФайлаВХранилище );

ДвоичныеДанные.Записать(ПолучитьИмяВременногоФайла(«doc»));

   ВедущийП

18 — 18.09.15 — 16:23

(16) Путь к файлу, который находится на сервере. А ты или не на сервере, или,  если на сервере, у тебя нет доступа к папке пользователя, под которым запущен сервер 1с.

   evorle145

19 — 18.09.15 — 16:27

(18) , да, доступа нет, совершенно верно. Сейчас буду делать как вы сказали. Только хотел бы еще просить взглянуть на (17), что я не так тут сделал, что опять валится в исключение, вот сам код:

Макет = ПолучитьМакетСервер(АдресФайлаВХранилище); //серверная функция, записывает макет в файл и возвращает полное имя файла  

        ДвоичныеДанные = ПолучитьИзВременногоХранилища(АдресФайлаВХранилище );

        ИмяФ = ПолучитьИмяВременногоФайла(«doc»);

        ДвоичныеДанные.Записать(ИмяФ);

        Попытка        

            КомОбъект = ПолучитьCOMОбъект(ИмяФ); //инициализируем COM-объект

        Исключение

            КомОбъект = 0;

            Сообщение = Новый СообщениеПользователю;

            Сообщение.Текст = ОписаниеОшибки();

            Сообщение.Сообщить();

            
        КонецПопытки;

   evorle145

20 — 18.09.15 — 16:28

В функцию добавил помещение во временное хранилище:

Функция ПолучитьМакетСервер(АдресФайлаВХранилище)

    Об = РеквизитФормыВЗначение(«Объект»);

    Макет = Об.ПолучитьМакет(«Макет»);  

    ИмяФайла = ПолучитьИмяВременногоФайла(«doc»);

    Макет.Записать(ИмяФайла);

    ДвоичныеДанные = Новый ДвоичныеДанные(ИмяФайла);

    АдресФайлаВХранилище = ПоместитьВоВременноеХранилище(ДвоичныеДанные);

    
    Возврат ИмяФайла;

    
КонецФункции

   Serginio1

21 — 18.09.15 — 16:43

(17) А разве нельзя просто

ДвоичныеДанные = Новый ДвоичныеДанные(ИмяФайла);

      Возврат ДвоичныеДанные ;

   evorle145

22 — 18.09.15 — 16:46

(21) Может быть и так тоже работает! Прошу меня просить, код в (19)-(20) полностью рабочий!! Спасибо больше Serginio1 и ВедущийП  за помощь! Воспользовался советом в (11)

  

Serginio1

23 — 18.09.15 — 16:52

Понравилась статья? Поделить с друзьями:
  • Ошибка получения объекта com 2147221164 0x80040154 класс не зарегистрирован
  • Ошибка получения параметров информационной базы ошибка при получении
  • Ошибка получения объекта com 2147221021 0x800401e3 операция недоступна
  • Ошибка получения параметров информационной базы информационная база не зарегистрирована
  • Ошибка получения объекта com 2147221020 0x800401e4 синтаксическая ошибка