8 Replies - 2867 Views - Last Post: 28 November 2008 - 12:10 PM Rate Topic: -----

#1 PRC   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-April 08

Need Help with (VBA) Ms. Word

Post icon  Posted 04 October 2008 - 08:02 PM

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:

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

Is This A Good Question/Topic? 0
  • +

Replies To: Need Help with (VBA) Ms. Word

#2 akhileshbc   User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 179
  • Joined: 27-September 08

Re: Need Help with (VBA) Ms. Word

Posted 04 October 2008 - 11:26 PM

Try this:
load form2
form2.Show
Was This Post Helpful? 0
  • +
  • -

#3 PRC   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-April 08

Re: Need Help with (VBA) Ms. Word

Posted 04 October 2008 - 11:48 PM

View Postakhileshbc, on 4 Oct, 2008 - 11:26 PM, said:

Try this:
load form2
form2.Show



Now it gives me a run time error " 424" and says 'object required'
Was This Post Helpful? 0
  • +
  • -

#4 akhileshbc   User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 179
  • Joined: 27-September 08

Re: Need Help with (VBA) Ms. Word

Posted 04 October 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... :)
Was This Post Helpful? 0
  • +
  • -

#5 PRC   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-April 08

Re: Need Help with (VBA) Ms. Word

Posted 05 October 2008 - 12:01 AM

View Postakhileshbc, on 4 Oct, 2008 - 11:56 PM, said:

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... :)


same error appears, now for form2.show line
Was This Post Helpful? 0
  • +
  • -

#6 akhileshbc   User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 179
  • Joined: 27-September 08

Re: Need Help with (VBA) Ms. Word

Posted 05 October 2008 - 01:39 AM

i have no experience with vbscript-macro. But only in vb6. So you better wait and listen what others have to say.... :)
Was This Post Helpful? 0
  • +
  • -

#7 thava   User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,607
  • Joined: 17-April 07

Re: Need Help with (VBA) Ms. Word

Posted 05 October 2008 - 01:56 AM

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: 05 October 2008 - 01:58 AM

Was This Post Helpful? 0
  • +
  • -

#8 zlatan24   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 28-November 08

Re: Need Help with (VBA) Ms. Word

Posted 28 November 2008 - 10:14 AM

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.
Was This Post Helpful? 0
  • +
  • -

#9 VB Crash   User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 130
  • Joined: 28-November 08

Re: Need Help with (VBA) Ms. Word

Posted 28 November 2008 - 12:10 PM

Well there must something wrong in your code... or somethig else

Private Sub CommandButton1_Click()
UserForm2.Show
End Sub




This is working very well ... use it

Vace
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1