Separate process is not creating in MS PowerPoint while creating in MS Word and Excel - powerpoint

We have designed Microsoft Addins for MS PowerPoint 2019 written in VB.net.
There I am trying to create separate process in MS PowerPoint to open a presentation/file using the given below snippet
Dim objPpt As PowerPoint.Application
Dim objDoc As PowerPoint.Presentation
objPpt = CreateObject("Powerpoint.Application")
objDoc = objPpt.Presentations.Open(processFile, False, , True)
objPpt.Visible = True
but it creates threads of Parent file and does not open a file as a separate process where in MS Word I use the given below snippet
Dim objWord As Word.Application
Dim objDoc As Word.Document
objWord = CreateObject("Word.Application")
objDoc = objWord.Documents.Open(processFile, , , True, , , , ,, , , , ,, ,)
objWord.Visible = True
And it opens the word document as a separate process.
So I need to create separate process for each file/presentation in MS PowerPoint
Can you help in resolving this issue ?
Here are some more information about on which environment I'm working :
Operating System : Microsoft Windows 10 Pro
Code Editor : Visual Studio 2019
Technology : Vb.net(.Net Framework 4.8)
MS Office Version : 2019(32 bit)

Word and Excel both allow multiple instances of themselves to be created.
PowerPoint does not (other than as the result of an obscure bug).

I would like to share the impact of trying multiple applications of PowerPoint. As per the Microsoft paragraph below it will be sharing the process so painting of Menu bar/Standard bar/Add-ins tabs must be sharing objects so you cannot perform operation independently. Performed operation will going to impact other PPT screen.
Refer Link: About PowerPoint Instance
Multiple instances of Word (Winword.exe), Excel (Excel.exe), and Microsoft Access (MSAccess.exe) can run simultaneously. Therefore, these servers are defined as Single Use (Multiple Instances) servers. Only one instance of PowerPoint (Powerpnt.exe) can run at any given time. Therefore, PowerPoint is a Multiuse (Single Instance) server.
Also refer screenshot:

Related

Start Outlook 2016 (64 Bit) automatically minimised to Windows 10 (64 Bit) system tray - No active Explorer object found

I have an issue with an auto start of Outlook 2016 at boot/log on which is intended to start Outlook minimised to the Windows system tray, such that once invoked at Windows 10 launch mail will be collected by the mail account(s) (NB. All POP in this case.) whilst the program resides in the system tray remaining invisible until required by the user.
The .vbs script below does function as required but much of the time it introduces two unwelcome issues.
The Outlook icon in the System Tray displays a 'cog' overlay with the message "Another program is using Outlook. To disconnect programs and exit Outlook, click the Outlook icon and then click Exit Now".
Attempts to open Outlook from the 'Open Outlook' context menu (right click Outlook icon in the tray) item causes a dialogue box to appear reporting "No active explorer object found". Clicking the "OK" option in response launches Outlook (though issue 1 - cog overlay) remains.
Neither issue is present when Outlook is started normally from the desktop so it would appear that the .vbs script is in someway responsible. I have used this script successfully (see also below: https://superuser.com/questions/467809/start-outlook-automatically-in-tray) in the past both as a startup menu shortcut and a hkcu 'run' registry entry.
Can anyone suggest the cause or alternately a suitable code revision to achieve correct function? In case it is significant, Windows 10 is 64 bit Pro and the version of Office (including Outlook) installed is also 64 bit.
This is the code invoked by the .vbs script:
OPTION EXPLICIT
OPTION EXPLICIT
CONST PATH_TO_OUTLOOK = """C:\Program Files\Microsoft Office\Office16\OUTLOOK.EXE"""
CONST SHOW_MAXIMIZED = 3
CONST MINIMIZE = 1
DIM shell, outlook
SET shell = WScript.CreateObject("WScript.Shell")
' Open Outlook
shell.Run PATH_TO_OUTLOOK, SHOW_MAXIMIZED, FALSE
ON ERROR RESUME NEXT
' Grab a handle to the Outlook Application and minimize
SET outlook = WScript.CreateObject("Outlook.Application")
WScript.Sleep(100)
outlook.ActiveExplorer.WindowState = SHOW_MAXIMIZED
' Loop on error to account for slow startup in which case the
' process and/or the main Outlook window is not available
WHILE Err.Number <> 0
Err.Clear
WScript.Sleep(100)
SET outlook = NOTHING
SET outlook = WScript.CreateObject("Outlook.Application")
outlook.ActiveExplorer.WindowState = MINIMIZE
WEND
ON ERROR GOTO 0
SET outlook = NOTHING
SET shell = NOTHING
Having spent a number of hours on this issue over the weekend I thought that I had resolved the issues and got everything functioning as intended.
Working from similar samples of code I compiled a new script (see below) which I applied both as a shortcut in the Startup folder and also as an entry into the 'run' branch of the HKCU registry.
Now for the issue! Testing the script on two separate Windows 10 Pro (both 64 Bit architecture) systems both with Outlook 2016 64 Bit installed as part of a 64 Bit Office suite I found that whereas on one system the script runs flawlessly on the other I receive the following runtime error:
Script: D:\Neil's Files\Neil's Filing Cabinet\Neil's Emails\Start Outlook Minimised to Tray\Start Outlook 2016 Minimised To Tray.vbs
Line: 11
Char: 5
Error: ActiveX component can't create object: 'GetObject'
Code: 800A01AD
Source: Microsoft VBScript runtime error
This has me perplexed as the script file and it's related shortcut are both physical copies of each other given that the revised script below contains no path references (as these are handled directly by the code in respect of Outlook.exe) which are identified by the placement of either the shortcut or as the data element of the registry string whichever format is used.
The Systems do have some differences however and for comparative purposes I will summarise those I feel to be relevant here:
System 1: (The problem system) is an X58 Asus P6T7, Intel i720 mature PC with many programs installed and specifically the Outlook 2016 has the same 12 addins installed but in addition has two related programs which launch at boot, the enterprise editions of 4team's Sync2 for Microsoft Outlook and Safe PST Backup. The boot times are quite lengthy (but acceptable) as is the Outlook Startup with it's various addins.
System 2: Is a current generation Asus X99-Deluxe, i7 5930 new build pc with little installed as yet save MS Office, Adobe CC and some utilities.
In the case of System 1, Outlook auto-starts as intended however during it's loading splash screen (whilst it is loading up the addins) the runtime error is displayed although Outlook continues to open fully but fails to minimise.....
This suggests to me that the faulting code is the section which activates the window however the above error message refers to "ActiveX component can't create object: 'GetObject'" which suggests instead an issue with the code line "Set OLObj = GetObject("","Outlook.Application")"??
Hopefully somebody can test the code on a similar setup and report back? Or alternately, give me a pointer as to what is going on and how I might resolve it. I would of course also welcome any suggested improvements to the code!
** Quick Update ** Now tested on HP Elitebook 8440P Laptop - Windows 10 Pro 64 Bit with Office 64 Bit + same 12 Outlook Addons - Functions as intended.....
** Further Update ** Tested on a second HP Elitebook 8440P Laptop - Windows 10 Pro 64 Bit with Office 64 Bit + same 12 Outlook Addons - Above RunTime error experienced once again.......struggling to comprehend why these results are occurring?? Any thoughts anybody???
The code below is offered "as is" for the benefit of anyone else seeking the same Outlook auto start criteria. The testing with System 2 indicates that it works so I hope others enjoy similar success until the outstanding issues are sorted.
NB: To adjust the Outlook Launch Window Size (during its 10 second pause prior to automated minimising) to reflect personal preferences change the numeric value in the following line of code:
WshShell.Run "OUTLOOK.EXE" , 3, false
For a maximised window size change the value to 3 For a restored window size change the value to 2
OPTION EXPLICIT
Dim WshShell
Dim OLObj
Set WshShell = WScript. CreateObject ( "Wscript.Shell" )
'Open Outlook: Note that inspite of the launch options, it will open the program in a normal window.
'The file location path is not necessary as Windows 10 correctly identifies Outlook's location.
WshShell.Run "OUTLOOK.EXE" , 3, false
'This will mimimise it to the system tray after a 10 second pause to allow for mail collection on Outlook launch.
WScript.Sleep (10000)
Set OLObj = GetObject("","Outlook.Application")
'Activates the window
OLObj.ActiveExplorer.Activate
'Sends the command to minimise
OLObj.ActiveExplorer.WindowState = 1
'Outlook does not immediately minimise to the system tray so that 'Send/Receive' can initiate mail collection.
Thanks to jrv from Microsoft's "The Scripting Guys" forum who kindly offered a revised (simplified) code which is below. I can report that as with the original code it works flawlessly on the same 2 systems as before, whilst faulting once more on the other two......very much perplexed!!
The Runtime Error:
Script: D:\Neil's Files\Neil's Filing Cabinet\Neil's Emails\Start Outlook Minimised to Tray\Start Outlook 2016 Minimised To Tray.vbs
Line: 3
Char: 5
Error: ActiveX component can't create object: 'Outlook.Application'
Code: 800A01AD
Source: Microsoft VBScript runtime error
The revised code:
Set WshShell = CreateObject ( "Wscript.Shell" )
WshShell.Run "OUTLOOK.EXE" , 3, False
Set ol = CreateObject("Outlook.Application")
ol.ActiveExplorer.Activate
ol.ActiveExplorer.WindowState = 1
You can use like file *.reg:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Outlook"="C:\\Windows\\system32\\cmd.exe /c \"start \"\" /min \"C:\\Program Files\\Microsoft Office\\Office16\\OUTLOOK.EXE\"\""
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Preferences]
"MinToTray"=dword:00000001
I have an answer that works well with Office 2013 on Windows 7, and I hope it works for you too.
Essentially, this solution bypasses the issue with trying to force Outlook to minimize after loading. Instead, it relies on using a shortcut that's already configured to load the program in a minimized state.
Copy a shortcut to Outlook into the directory containing your script.
Right click the shortcut and open Properties.
In the Shortcut tab, change the Run mode to Minimized. Press OK.
Then, all you need to do in your VBScript file is to execute the shortcut like so:
Dim sh : Set sh = CreateObject("WScript.Shell")
sh.run "Outlook.lnk"
Note that because this solution uses a shortcut, you could potentially remove the VBScript part entirely by putting the shortcut into the All Users Startup folder.
It's me again! I have an answer that should bypass any issues with VBScript by using third-party software, DisplayFusion. I don't know how you'll feel about that, but I tested it and it works over here. I use this at home and at work to manage multiple monitors and various other things. It may even help solve problems with other programs you use and render various VBS hacks redundant.
In your case, there is a feature called 'Triggers'. Note that while there is a free version of DF, you'll have to activate a 30 day trial for the Pro version to use Triggers, and after that, it's up to you to decide if it's worth your while.
Firstly, after installing DF, you'll want to open up its settings window (right-click desktop and go to DisplayFusion > Settings).
Go to the Triggers tab and click Add.
Set up the trigger for when a window is created. Tell the trigger to activate only once per process ID so it won't also try to minimize subsequent windows, such as when composing a new email. Find the path to your outlook.exe. Then, add an action on the right-hand side to minimize the window.
Click OK twice and then see if it works by loading Outlook. For me, the splash screen appears as normal, then the main window is minimized as soon as it appears.
DF runs as a system service with admin privileges and has been tested with tonnes of software packages, so if this method also fails for you, it could indicate bigger issues with your system/Office configuration.

ActiveX cannot create object on Set outA = CreateObject("Outlook.Application")

I have a legacy VB6 application to allow a user to send an email from the application itself.
Dim outA As Outlook.Application
Set outA = New Outlook.Application
If outA Is Nothing = True Then
'Outlook is not open... so need to create a new outlook
Set outA = CreateObject("Outlook.Application")
End If
In Windows 7 Office 2007 it works. User can have Outlook open and it works with no issues.
In Windows 10 Office 2016 this code does not work. It gives me an error on
Set outA = New Outlook.Application.
If Outlook is not open, the code works. I'm only getting this error if Outlook is open.
The error is...
ActiveX cannot create object error 429.
I have local privelages on my computer.
If I open my VB6 .exe explicitly as ADMIN and Outlook as ADMIN as well - the code gives me no issues.
I have UAC prompt disabled.
I cannot give ADMIN rights to user.
Am I missing a dll or something? I have a few more applications that have been used in Windows 7 and I have not had this issue.
Keep the early binding for development and once complete, scrap it for the late bind. Don't forget to remove the reference to Microsoft Outlook xx Object Library in VBE.
Early binding:
Dim outA As Outlook.Application
Set outA = New Outlook.Application
Late Binding:
Dim outA As Object
Set outA = CreateObject("Outlook.Application")
The reason is that early binding references a specific version of Outlook e.g. Microsoft Outlook 14.0 Object Library which is specific for Office 2010, so if it's not available it throws an error. The reference itself is marked with a "missing".
The late binding's CreateObject("Outlook.Application") takes care of that.
Repare office and ok (for me that was the solution)

vb6 installation on Win 8.1

For several years I have been running a compiled VB6 program on an church office computer. I had the vb6 program installed on my home computer (Win 7) This program ran without problems. The program opened Excel spreadsheets and allowed the user to manipulate the data on the spreadsheet.
My Windows 7 computer crashed. I have a Windows 8.1 computer and have loaded vb6 on this computer. The installation appears to be successful except when I run the same visual basic project I get a Runtime Error '-2147319779 Automation Error Library not registered.' A sample of my code is shown below:
Dim oExcel As Excel.Application
Set oExcel = Excel.Application
oExcel.Workbooks.Open ("C:\FPCE Financial\FY-2014\2014-01 Financials.xls")
Application.Visible = True
The error occurs on the "Set oExcel = Excel.Application" line.
Any help would be appreciated.
If you haven't set a reference to Excel you need to use "Late Binding" to create the Excel object. As #Noodles says - if you don't have Office installed, it won't work period.
Try changing this
Dim oExcel As Excel.Application
Set oExcel = Excel.Application
To this
Dim oExcel As Object
Set oExcel = CreateObject("Excel.Application")

How can I programatically tell what Outlook addins are installed, and if they are enabled or not?

How do I determine what Outlook COM or PIA addins are installed, and if they are enabled or not.
How can I get this information, and hopefully the file version as well?
(1) If you want to access this information from inside another Outlook Add-in, you may use the the Application.ComAddins object (e.g. it's Count property gives you the number of add-ins installed). You can loop through this collection and check the LoadBehaviour property of the single COMAddin object to now if they're loading or if they're disabled.
(2) If you wand to access the information from outside of Outlook, you may consider to read the appropriate registry entries under the Software\Microsoft\Office\Outlook\Addins key.
(3) Please be aware that you cannot trust this information at all, because Office add-ins can be installed either for a single user or for all users. So you cannot access the installed add-ins absolutely, but only for the current user running your app /your procedure, by reading the abovementioned key (a) under HKLM and (b) under HKCU. The Application.COMAddins object shows you both information blended in one.
(4) I don't recall that a version number is available either in the COMAddin object or in the registry. To access that, you'll have to read the registry to find the file or assembly of the add-in, and access the file version. Please note that "old" COM Add-ins written in Visual Basic 6 or another language have other registry entries than VSTO add-ins or add-ins based on the Add-in Express tool.
To determine which installed add-ins are active (enabled/loaded):
'Loop through all installed add-ins and show whether they are active or not.
Dim app As New Outlook.Application
Dim name As String
Dim loaded As Boolean
For i = 1 To app.COMAddIns.Count
name = app.COMAddIns.Item(i).Description
loaded = app.COMAddIns.Item(i).Connect 'Returns True for active, False for inactive
MsgBox(name & ": " & loaded)
Next
To check the status of a specific add-in by name:
Dim app As New Outlook.Application
Dim addinName As String = "ADD-IN NAME"
Dim loaded As Boolean = app.COMAddIns.Item(addinName).Connect
MsgBox(addinName & ": " & loaded)
You can access that information even from outside of outlook.
Dim count As Integer
Dim app As New Outlook.Application
count = app.COMAddIns.Count
For i = 1 To count
MsgBox(app.COMAddIns.Item(0).Description)
Next

How Do I Prevent the Installer from Running when Application Data Files are Removed?

I have an application written in VB.Net with Visual Studio 2005. The application allows the user to create and save project files. When I distribute the application, I include some demo project files, which I install in the common application data folder.
XP - C:\Documents and Settings\All Users\Application Data
Vista & 7 - C:\Program Data
I have discovered an unexpected behavior -- if any file in the common application data folder is removed, and the application is run from the start menu, then the install procedure will start and attempt to restore the missing file(s). If the MSI file no longer exists at its original location or has been changed, then the application will fail to run. I perceive that this is a "feature", but it is one I don't want. Can anyone tell me what is going on and how I can avoid it?
Some more details:
I created the setup package by using a Visual Studio deployment
project.
This behavior will not occur if I launch the EXE directly. I
expect, therefore, that the behavior has something to do with the
start menu shortcut. I've noticed that the shortcut isn't a normal
shortcut -- it doesn't have a "Target Location".
All advice is appreciated.
-TC
I have learned that this behavior involves something called "Install-on-Demand" (aka "Self Heal"). The unusual shortcuts created by the setup package are called "Advertised Shortcuts". Now that I have a name for the problem, it is easy to find information on how to fix it. Notably:
http://msdn.microsoft.com/en-us/library/aa368297.aspx
http://groups.google.com/group/microsoft.public.dotnet.distributed_apps/browse_thread/thread/401847045f104af3
http://blog.jtbworld.com/2007/11/enable-target-and-change-icon-of.html
Those pages contain a wealth of information. For the convenience of others who may stumble upon this post, I will summarize what they say:
Advertised shortcuts are special shortcuts which do some fancy things. Most notably, they reinstall damaged application before launching their target. There is some debate over whether they are good, evil, or harmless. In my opinion, they do something most users don't expect, and that makes them evil. Therefore, I'd like to disable them for my application.
Visual Studio setup projects automatically create MSI packages which generate advertised shortcuts by default. It is easy to override that default when installing the MSI package by using DISABLEADVTSHORTCUTS=1 as a command-line argument for Setup.exe. Also, with a utility like Orca, you can manually change the default by inserting DISABLEADVTSHORTCUTS=1 as a property of the MSI. However, if you want Visual Studio to automatically create MSI packages which don't create advertised shortcuts, that is harder. I did it this way:
First, I created a VBS file using the DisableAdvt code provided by Gary Chang in one of the links above (I've repeated that code below). Just create a text file, paste in the code. and save it as DisableAdvt.vbs.
Then, create a post-build event for your setup project. The exact syntax will depend on your file locations. Because my DisableAdvt.vbs is in a "Tools" subfolder of the solution folder, my post-build event looks like this:
"$(ProjectDir)..\Tools\DisableAdvt\DisableAdvt.vbs" "$(BuiltOuputPath)"
That's all I had to do. It works like a charm.
-TC
Some notes:
In Visual Studio 2005, Build events are accessed differently for setup projects than they are for other types of projects. Click on the project name in the solution explorer, then look for PostBuildEvent in the Properties pane.
Orca is a utility that can be used to manually insert the DISABLEADVTSHORTCUTS property into the MSI file. With my approach, Orca is not necessary. However, it is useful for verifying that the build event is making the expected change.
http://www.technipages.com/download-orca-msi-editor.html
In the build event, the misspelling "BuiltOuputPath" is intentional.
Here is Gary Chang's DisableAdvt.vbs code (note that I fixed a typo on line 21 -- Very important!):
Option Explicit
Const msiOpenDatabaseModeTransact = 1
Dim argNum, argCount:argCount = Wscript.Arguments.Count
Dim openMode : openMode = msiOpenDatabaseModeTransact
' Connect to Windows installer object
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") :
CheckError
' Open database
Dim databasePath:databasePath = Wscript.Arguments(0)
Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError
' Process SQL statements
Dim query, view, record, message, rowData, columnCount, delim, column
query = "INSERT INTO Property(Property, Value) VALUES ('DISABLEADVTSHORTCUTS', '1')"
Set view = database.OpenView(query) : CheckError
view.Execute : CheckError
database.Commit
If Not IsEmpty(message) Then Wscript.Echo message
Wscript.Quit 0
Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbLf & errRec.FormatText
End If
Fail message
End Sub
Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub

Resources