VBA Help: 3rd .Show command don't work

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,681
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi.
I make userforms and I want when I click on button on userform 1 , it unloads and then show other userforms.
Then I write This Code For Userform1:
Code:
Option Explicit

Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
Me.Height = 0
Call SetWindowLong(GetForegroundWindow, -16, GetWindowLong(GetForegroundWindow, (-16)) And (Not &H400000))
Me.Height = 140
End Sub
Private Sub Welcome_Activate()
  RemoveFrame
End Sub

Private Sub EnterData_Click()
Unload Me
InputData.Show
End Sub

Private Sub Report_Click()
Unload Me
SeedReport.Show
End Sub

Private Sub AddNew_Click()
Unload Me
[COLOR=#daa520]AddNew.Show[/COLOR]
End Sub

But for the Last (yellow Line) code it show
Code:
Compile error:
Method or Data Member not found

Please Help
What is my Fault.

Thanks
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Are you sure your form is named "AddNew"?
 
Upvote 0
Yes. I sure.
I change the name of userform and the command but show same error.
When I write code after addnew. when show commands for help, I don't see .show command only for this line.
 
Upvote 0
Your button is called AddNew too. They should not have the same name.
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,272
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top