打开文件时,在新的Excel实例中打开特定的Excel文件 [英] Open specific Excel file in new instance of Excel when file is opened

查看:72
本文介绍了打开文件时,在新的Excel实例中打开特定的Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

信息:

我有一个名为Demo.xlsm的Excel文件

I have an Excel file named Demo.xlsm

此文件包含一个名为UserForm1的用户窗体,该用户窗体在打开文件时会自动加载.

This file contains a userform named UserForm1 which automatically loads when the file is opened.

打开文件后,在用户窗体后面的背景中也可以看到名为Demo.xlsm的工作簿.

The workbook named Demo.xlsm is also visible in the background behind the userform when the file is opened.

问题:

我经常在桌面上打开一个Excel应用程序,其中包含各种工作簿和工作表,其中包含我每天使用的信息.就目前而言,如果我打开Demo.xlsm文件,它将在当前Excel应用程序中以及我正在使用的所有其他工作簿/工作表中打开.

I often have an Excel application already open on my desktop with various workbooks and worksheets containing information I use on a daily basis. As it stands, if I go to open the Demo.xlsm file, it will open in the current Excel application along with all of the other workbook/worksheets I am using.

首先:我想让Demo.xlsm文件在一个与我的其他作品完全不同的实例/Excel应用程序中自动打开.

First: I would like for the Demo.xlsm file to automatically open in an entirely separate instance/Excel application than my other works.

第二:我只希望可见用户表单.(我不需要/不需要在后台显示工作簿/工作表.)

Second: I would like for only the userform to be visible. (I have no need/use for the workbook/worksheets to be visible in the background.)

第三:如果可以在仍显示用户窗体的同时最小化Excel应用程序的第二个实例,那将是完美的.(当前,如果我尝试最小化Excel应用程序的第二个实例,则用户窗体也会被最小化)

Third: If its possible to have the 2nd instance of the Excel application to be minimized while still displaying the userform, that would be perfect. (Currently, if I attempt to minimize the 2nd instance of the Excel application, the userform is also minimized)

  Private Sub Workbook_Open()
  Dim objExcel
  Set objExcel = CreateObject("Excel.Application")
  objExcel.Visible = True

  UserForm1.Show

  Application.ScreenUpdating = False
  Set newBook = Workbooks.Open(Demo.xlsm)
  Windows(Demo.xlsm).Visible = False
  Application.ScreenUpdating = True 

  End Sub

我觉得我没有正确的方法...

I feel that I am not going about this the right way...

任何对此的帮助将不胜感激!

Any help with this would be greatly appreciated!

推荐答案

这就是我所做的,而且效果很好.我有一张工作表,上面有一张不错的大图片,并且图片上有一个宏,它是:

This is what I do, and it works lovely. I have a sheet with a nice big picture, and the picture has a macro, which is:

Dim appXL As New Excel.Application

appXL.Workbooks.Open "G:\All Users\Jurie\Test\Hotel Maintenance V1SE.xlsm"
appXL.ActiveWorkbook.Windows(1).Visible = True
appXL.Visible = True
Workbooks("Hotel Stay Easy Maintenance Program.xlsm").Close   SaveChanges:=True
ThisWorkbook.Activate

这会在自己的实例中打开我的文件,我可以根据需要关闭它,它不会干扰任何其他打开的文件.

This opens my file in its own instance and I can close it as I want, it does not interfere with any other open files.

这篇关于打开文件时,在新的Excel实例中打开特定的Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆