Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,203 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,450 people online right now. Registration is fast and FREE... Join Now!




Need Help with (VBA) Ms. Word

 
Reply to this topicStart new topic

Need Help with (VBA) Ms. Word

PRC
4 Oct, 2008 - 07:02 PM
Post #1

New D.I.C Head
*

Joined: 1 Apr, 2008
Posts: 3

Hi ,

i'm trying to write a code in Word VBA, that should let the command button open another form. i have tried the following:

CODE
form.open=new form.form2
form2.show


however when i rum it, an error pops up saying that the user defined type not defined.

how can i fix this problem? can anyone pls tell me how i can get the commandbutton to open the form

Thanx



User is offlineProfile CardPM
+Quote Post


akhileshbc
RE: Need Help With (VBA) Ms. Word
4 Oct, 2008 - 10:26 PM
Post #2

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 6 times
Dream Kudos: 50
My Contributions
Try this:
load form2
form2.Show
User is offlineProfile CardPM
+Quote Post

PRC
RE: Need Help With (VBA) Ms. Word
4 Oct, 2008 - 10:48 PM
Post #3

New D.I.C Head
*

Joined: 1 Apr, 2008
Posts: 3

QUOTE(akhileshbc @ 4 Oct, 2008 - 11:26 PM) *

Try this:
load form2
form2.Show



Now it gives me a run time error " 424" and says 'object required'
User is offlineProfile CardPM
+Quote Post

akhileshbc
RE: Need Help With (VBA) Ms. Word
4 Oct, 2008 - 10:56 PM
Post #4

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 6 times
Dream Kudos: 50
My Contributions
whick line is howing that error.?
form2 is the name of the form. I think the Load command is causing this error(its for vb6). just try the only line:

Form2.Show

Remember, Form2 is the name of the form you want to show... smile.gif
User is offlineProfile CardPM
+Quote Post

PRC
RE: Need Help With (VBA) Ms. Word
4 Oct, 2008 - 11:01 PM
Post #5

New D.I.C Head
*

Joined: 1 Apr, 2008
Posts: 3

QUOTE(akhileshbc @ 4 Oct, 2008 - 11:56 PM) *

whick line is howing that error.?
form2 is the name of the form. I think the Load command is causing this error(its for vb6). just try the only line:

Form2.Show

Remember, Form2 is the name of the form you want to show... smile.gif


same error appears, now for form2.show line
User is offlineProfile CardPM
+Quote Post

akhileshbc
RE: Need Help With (VBA) Ms. Word
5 Oct, 2008 - 12:39 AM
Post #6

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 6 times
Dream Kudos: 50
My Contributions
i have no experience with vbscript-macro. But only in vb6. So you better wait and listen what others have to say.... smile.gif
User is offlineProfile CardPM
+Quote Post

thava
RE: Need Help With (VBA) Ms. Word
5 Oct, 2008 - 12:56 AM
Post #7

D.I.C Addict
Group Icon

Joined: 17 Apr, 2007
Posts: 670



Thanked: 35 times
Dream Kudos: 75
My Contributions
not mush more difference that vb6 and vba little bit

ok
what is your form name is the form name is form2 then check the following else change the form2 to your form name
did you have any code in form_load event or form_activate event then check that code is correct if all are right then verify that form is in your macro project if not add it that's all your error will be cleared

This post has been edited by thava: 5 Oct, 2008 - 12:58 AM
User is offlineProfile CardPM
+Quote Post

zlatan24
RE: Need Help With (VBA) Ms. Word
28 Nov, 2008 - 09:14 AM
Post #8

New D.I.C Head
*

Joined: 28 Nov, 2008
Posts: 2

For word files i used one good tool,me advised it friends-word fix,application effectively recover the text information from corrupted Microsoft Word documents and templates,can work with text files of various formats: Microsoft Word documents and templates of various versions (.doc, .docx, .dot, .dotx files) and Rich Text documents (.rtf files),recover information from corrupted Microsoft Word documents and templates located on corrupted media (floppy disks, CDs, DVDs, Zip drives, etc.),Export the recovered information both to Microsoft Word and to a plain text file.compatible with Windows 2000, Windows XP, Windows XP SP2, Windows 2003, Windows Vista.
User is offlineProfile CardPM
+Quote Post

VB Crash
RE: Need Help With (VBA) Ms. Word
28 Nov, 2008 - 11:10 AM
Post #9

D.I.C Head
**

Joined: 28 Nov, 2008
Posts: 130



Thanked: 7 times
My Contributions
Well there must something wrong in your code... or somethig else

CODE


Private Sub CommandButton1_Click()
UserForm2.Show
End Sub



This is working very well ... use it

Vace
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:36AM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month