Link to home
Start Free TrialLog in
Avatar of BPerez
BPerez

asked on

How to remove a form from olPersonalRegistry?

I am creating a small application to allow remote users to publish forms to their personal form library but would like to update or remove (and then add) forms with the same name. Currently the code I have will install mutiple forms of the same name in their Personal Form Library. Can anyone help me with the code to REMOVE a form from the library?? I am automating Outlook from a VB 6.0 program.



Dim filename As String
Dim Temp As String
Dim endpos As Integer
Dim mylength As Integer
Set myOlApp = GetObject("", "Outlook.Application")
' retrieve Outlook Templates
filename = Dir$("c:\temp\formsdata\*.oft", vbNormal)
Do Until filename = ""
mylength = Len(filename)
' strip off the extension from the filename. This will be the name of the form.
endpos = InStr(1, filename, ".oft", 1)
strTemp = Trim(Mid(filename, 1, endpos - 1))
' publish all Outlook forms into the Personal Registry
Set myItem = myOlApp.createitemfromtemplate("C:\temp\formsdata\" & filename)
Set myform = myItem.formdescription
myform.Name = strTemp
'Remove old form code here
myform.PublishForm olPersonalRegistry
filename = Dir$
Loop


Thanks,

Brent
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hello Brent,

you could do something like

  If Dir("c:\temp\r.trt", 0) <> "" Then
    Kill "c:\temp\r.trt"
  End If

HAGD:O)Bruintje
Avatar of BPerez
BPerez

ASKER

I don't want to delete the physical ".oft" files is c:\temp\formsdata. I would like to remove the form from the Personal Forms Library within Outlook. Note: this can be done manually by going to Tools> Other> Advanced Options
>Manage Forms, etc.

Thanks, Brent
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BPerez

ASKER

I don't want to delete the physical ".oft" files is c:\temp\formsdata. I would like to remove the form from the Personal Forms Library within Outlook. Note: this can be done manually by going to Tools> Other> Advanced Options
>Manage Forms, etc.

Thanks, Brent
Avatar of BPerez

ASKER

sorry for the repost  ^^^^^^

Brent
as already said it's in the cache, your new version would overwrite the older one and you should update the version number that's on the property page of the form

even then you just overwrite the older one since you use the same name etc....

for the cache to clear the user needs to exit outlook and open it again

is there are a reason to keep the old one on the client?
Avatar of BPerez

ASKER

I am sorry, I thought that the form would enter a duplicate form and not overwrite the existing form (which is in cache). Is there any diff. between the Internet Only Mail installation and the Corporate Workgroup installation?

To summarize :
1) As long as the form I am publishing is named the same as the one in cache - it should be overwritten/updated.
2) Since the present code requires Outlook to be running with the forms are published the user will have to quit and restart after the program has completed.

And no, there is no reason to keep the old forms on the client computers. I was planning on moving those to a backup directory until the publishing process is done and then deleting the old forms.

Thanks, Brent
Hello BPerez, is this solved?
Hi BPerez ,

No comment has been added lately and it's time to clean up this Topic Area.
If this question isn't revived and no action is taken I will leave a recommendation in the Cleanup topic area  that this question is:

- answered by bruintje

Please leave any comments here within the
next seven days.

** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER ! **

Paulo
Cleanup Volunteer
Per recommendation

RotaredoM
CS Mod @ EE