Hi ,
I wrote some add in for PowerPoint and i'm trying to find an automatic way to load it every time PowerPoint starts.
I found Microsoft Code example (see below ) BUT the problem is :
I can't find all appear function declaration and VBA also errors regarding all the default variable values give in the code like ERROR_SUCCESS etc.
May be you can help me to make this code run?? -
-
Function RegisterAddin( _
-
strBranch As String, _
-
strAddinName As String, _
-
strAddinPath, _
-
fAutoLoad As Boolean) As Boolean
-
-
' Turn on error trapping.
-
On Error GoTo RegAddinError
-
Err.Clear
-
-
' Create the variable used in the call to RegCreateKeyEx().
-
Dim lhkeyHive As Long
-
Dim strSubKey As String
-
Dim lhkey As Long
-
Dim lDisp As Long
-
Dim lReturnVal As Long
-
-
' Make the branch string all caps.
-
strBranch = UCase(strBranch)
-
-
' Determine which branch of the registry to use.
-
Select Case strBranch
-
Case Is = "LOCAL"
-
lhkeyHive = HKEY_LOCAL_MACHINE
-
Case Is = "L"
-
lhkeyHive = HKEY_LOCAL_MACHINE
-
Case Is = "CURRENT"
-
lhkeyHive = HKEY_CURRENT_USER
-
Case Is = "C"
-
lhkeyHive = HKEY_CURRENT_USER
-
Case Else
-
' Passed in the wrong parameter, so use HKEY_LOCAL_MACHINE
-
lhkeyHive = HKEY_LOCAL_MACHINE
-
End Select
-
-
' Create the SubKey string.
-
strSubKey = "Software\Microsoft\Office\8.0\PowerPoint\AddIns\" & _
-
strAddinName
-
-
' Create or open the registry key.
-
lReturnVal = RegCreateKeyEx( _
-
lhkeyHive, _
-
strSubKey, _
-
0, _
-
"", _
-
REG_OPTION_NON_VOLATILE, _
-
KEY_ALL_ACCESS, _
-
vbNullString, _
-
lhkey, _
-
lDisp)
-
-
' See if error occurred when opening key.
-
If (lReturnVal <> ERROR_SUCCESS Or lhkey = 0) Then
-
RegisterAddin = False
-
Exit Function
-
End If
-
-
'Add the path to the add-in to the registry.
-
lReturnVal = RegSetValueEx( _
-
lhkey, _
-
"Path", _
-
0&, _
-
REG_SZ, _
-
strAddinPath, _
-
Len(strAddinPath))
-
-
' See if an error occurred when writing the registry key.
-
If (lReturnVal <> ERROR_SUCCESS) Then
-
RegisterAddin = False
-
Exit Function
-
End If
-
-
' Add the AutoLoad key if needed.
-
If fAutoLoad = True Then
-
-
'Add the path to the add-in to the registry.
-
lReturnVal = RegSetDwordValueEx( _
-
lhkey, _
-
"AutoLoad", _
-
0, _
-
REG_DWORD, _
-
&HFFFFFFFF, _
-
4)
-
-
' See if an error occurred when writing the registry key.
-
If (lReturnVal <> ERROR_SUCCESS) Then
-
RegisterAddin = False
-
Exit Function
-
End If
-
-
End If
-
-
' Close the registry key.
-
lReturnVal = RegCloseKey(lhkey)
-
-
' See if error occurred when closing the registry key.
-
If (lReturnVal <> ERROR_SUCCESS) Then
-
RegisterAddin = False
-
Exit Function
-
End If
-
-
' All is well, so return true.
-
RegisterAddin = True
-
-
' Exit the sub so that the code does not flow into
-
' the error handler.
-
Exit Function
-
-
' Handle an add-in registration error.
-
RegAddinError:
-
RegisterAddin = False
-
-
' Close the registry key if it is still open.
-
If lhkey <> 0 Then
-
RegCloseKey lhkey
-
End If
-
-
End Function
-
-
Function main()
-
-
-
If (RegisterAddin("HKEY_CURRENT_USER", "First.ppa", "C:\Documents and Settings\Administrator\Application Data\Microsoft\AddIns", True) = True) Then
-
MsgBox "It worked"
-
Else
-
MsgBox "it did not work"
-
End If
-
End Function
-
-
-
1 1822 Dököll 2,364
Recognized Expert Top Contributor
Pushing this forward for all to see, good of you to add your code by the way...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: careta |
last post by:
Hello,
I'm trying to automate PP creation from VB.net. The initial code is
(as extracted from MSDN's KB209960):
Public Sub Command1_Click()
' Start PowerPoint.
Dim ppApp As...
|
by: asadhussain |
last post by:
I am trying to automate conversion of powerpoint files to html. I have
developed this as a windows service and here is the conversion code:
....
PowerPoint.Application ppApp = new...
|
by: barry |
last post by:
Would like to know the syntax to start a powerpoint presentation from a
asp.net (vb.net) application
thanks
|
by: NETRavi |
last post by:
HI,
For one of our ASP.NET project we are generating a business graph
using a crystalreportviewer.
The crystalreportviewer gives the possibility of exporting to .htm, .doc, .
xls, .pdf, .rtf....
|
by: Rut |
last post by:
Does anyone know how to start powerpoint from vb.net without the ppt
screen appearing. I want to keep it hidden? Using this code:
Try
pp = New PowerPoint.Application
pp.Visible =...
| |
by: vegvegko |
last post by:
Hi,
Is there any way to build or distribute a C# application with a
Powerpoint component, so that the application can display Powerpoint
presentations on PCs that do not have Microsoft Office...
|
by: ssims |
last post by:
1) Is it possible to create a powerpoint file with asp.net? I've
Googled it and can't seem to find a definitive guide.
2) If it is possible to create a powerpoint file with asp.net, is it...
|
by: psuaudi |
last post by:
i have a powerpoint presentation that uses links to other files and are put on the slide using OLE.
The problem is that I have different users updating the information on the slides, which is not...
|
by: =?Utf-8?B?R2VvcmdlQXRraW5z?= |
last post by:
Greetings!
I wrote a small Exe that simply runs Shell to load PowerPoint and launch a
particular file, depending on the day of the week. However, it was set up for
office 2003 (I naively hardcoded...
|
by: =?Utf-8?B?V2FubmFiZQ==?= |
last post by:
Is there a website, or can someone show me how to open a Powerpoint template
and add data to it using the OpenXML format? I am very new to using any type
of XML, and really need a good example...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |