English 中文(简体)
采用传统做法的公开私人实例 [闭门]
原标题:Open Private Instance of Excel Using VBA [closed]
Closed. This question needs debugging details. It is not currently accepting answers.

我有一个“展望”宏观项目,该项目非常重要,因为每天将多次使用。 如果速度太慢,例如需要10至15秒才能执行,那么许多用户就只能获得使用。

我的法典大量使用单一Excel工作书。 在1至8秒之间开始编写工作手册(我不肯定为什么出现差异......——如果有任何建议加速这一进展,那将是麻烦的,但却是我试图通过这一职位实现的。)

由于开放时间太长,因此,我拿着Im的策略之一来迅速开张,就是在这种背景下开张Excel的工作书。 这样一来,《展望》一开始即开放,然后开放。 我的宏观职能不一定要开放和结束,即几乎是瞬时的。 《工作手册》是看不见的,通常都会加快调整(enableEvents = 虚假的,屏幕更新)。 False, showStatusBar =不实,显示器=虚假,xligationManual 。 迄今情况良好。

问题在于用户打开Excel文件和Windows grabs我的Excel。 显然,随着各种加快的环境,情况并不好。

我能够使每个宏观的加速环境变得可行,这将使用户能够打开一个新的Excel窗口。 我的隐蔽工作似乎更好但突然。 这将混淆用户,而不是产生巨大结果。

这种解决办法似乎可行,但似乎相当危险。 该书将登上《Excel 诉书》的登记,如果不予阻止,则将写上该登记处。 这意味着用户的Excel永远不会开放(WTF 微软!)。 可通过制定<代码>加以防止。 然而,确保其坚固的唯一途径是将其放在工作手册中,这就要求它具备宏观能力。

我不想因为行政部门设定的安全环境而使我的手册具有宏观能力。 手册必须仍然是XLSX文件。

从查询来看,似乎有可能改变登记处环境,以形成私人的前景。 然而,我没有行政特权,我只局限于展望宏观。 因此,没有这种选择。

是否有办法让《展望》创造出一个私人的Excel案例,同时又不使该手册的宏观功能化? 否则,在我使用Excel的事例时,是否有办法把我的工作书藏在用户手中?

If all of the above is impossible, is there a way to speed up the process of opening my workbook? As I mentioned above, in my testing, the time it takes to open is either about one second or about eight seconds. I have no idea why it s so quick sometimes and so slow at other times.

Edit: I slightly modified @FaneDuru s code below will reproduce the behaviour for me:

Sub testCreateExcelNewSession()
  Dim objExcel As Object, wb As Object, wbPath As String
  Dim ws as Object
  wbPath = "[redacted]users[redacted]homedocumentsdataRegisterV0.2.xlsx"

  Set objExcel = CreateObject("Excel.Application")
  
  With objExcel
    .Visible = False
    .DisplayAlerts = False
    Set wb = .Workbooks.Open (wbPath)

<Break point here!!> --> This is where I test to see if I can open a random other excel document. When I do this test, the hidden workbook appears.

    Set ws = wb.Worksheets(1)

  End With

  Set wb = Nothing: Set objExcel = Nothing
End Sub

我操作上述法典,打上了破碎点,然后打开了一张Excel文件,然后看上了隐藏的工作手册。

问题回答

正如第一份评论(确切地说)所述,新的工作手册在隐蔽的会议(可见)上不开放。 你没有展示你如何制造隐蔽的Excel会议。 不管怎样,使用下一个(简单)的法典,它会产生新的隐蔽会议,(理论上)不会用新的工作手册来公开。

A new workbook should be opening in a new session. Now, the problem becomes to identify the hidden session between the two (or more) sessions...

  1. Please, try using the next code to create the new hidden session and open the necessary workbook:
Sub testCreateExcelNewSession()
  Dim objExcel As Object, wb As Object, wbPath As String
  
  wbPath = "C:your excel workbook full name"
  Set objExcel = CreateObject("Excel.Application")
  
  With objExcel
    .Visible = False
    .DisplayAlerts = False
    .Workbooks.Open (wbPath)
  End With
  Set wb = Nothing: Set objExcel = Nothing
End Sub
  1. 开放新的工作手册(任何工作手册),并在新的可见的会议上看到。 如果不是的话,这可以(仅)与你使用的内容主管有关。 我相信,你能够在当地节省各自的工作手册。 如果是,请(按部就班)并再次开放当地道路。 现在应该像你需要的那样行事。

  2. Now, identify the hidden session using such a simple code:

Sub getHiddenExcelSession()
   Dim objExcel As Object, wb As Object, wbPath As String
   
   wbPath = "C:Teste VBA Excelexport.XLSX"
   Set objExcel = GetObject(wbPath).Application
   Set wb = objExcel.Workbooks(1)
   Debug.Print objExcel.hwnd, wb.Name

   Set objExcel = Nothing, Set wb = Nothing
End Sub




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签