Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Path/File access error ~ creating forms at runtime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
msdickey - 20 Dec 2004 15:11 GMT
Background:  I am trying to create userforms at runtime.  I am using the
following code to do so:

Do until frmcount > 5
Set newFrmTemp = ActiveDocument.VBProject.VBComponents.Add(vbext_ct_MSForm)

   With newFrmTemp
       .Properties("Name") = "frmTemplate" & frmcount
       .Properties("Caption") = "Template" & frmcount
       .Properties("Height") = 180
       .Properties("Width") = 273
   End With

frmcount = frmcount + 1
Loop

Question:  This creates 5 new userforms.  Let's say I run this macro and it
creates all the forms.  If I go and delete all of those forms created at
runtime and then try to rerun the macro again I get a Path/File access error.
For some reason it can't recreate those forms with that same name.  So, in
other words, everytime I want to rerun the macro I have to close the file and
reopen it to clear those form names.

Why am I having to do that? If I create forms at design and then delete them
I don't have trouble creating a new form with that same name again. What am I
doing wrong?  How can I fix it?
Word Heretic - 21 Dec 2004 23:25 GMT
G'day "msdickey" <msdickey@discussions.microsoft.com>,

Try unloading the forms instead if setting them to nothing - does that
help? This might be the difference I've been looking for :-)

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

msdickey reckoned:

>Background:  I am trying to create userforms at runtime.  I am using the
>following code to do so:
[quoted text clipped - 22 lines]
>I don't have trouble creating a new form with that same name again. What am I
>doing wrong?  How can I fix it?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.