How to remove a form from olPersonalRegistry?

BPerez
BPerez used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006

Commented:
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

Author

Commented:
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
Top Expert 2006
Commented:
the forms are hold in a cache file, if you up the version number of your form (don't know yet where this is hiding...)

you can read more on teh cache and how it works here
http://www.slipstick.com/dev/formscache.htm
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
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

Author

Commented:
sorry for the repost  ^^^^^^

Brent
Top Expert 2006

Commented:
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?

Author

Commented:
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
Top Expert 2006

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial