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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Sektor

Well-known Member
Joined
May 6, 2011
Messages
2,874
Office Version
  1. 365
Platform
  1. Windows
Are you sure your form is named "AddNew"?
 
Upvote 0

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,681
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
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

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,386
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Your button is called AddNew too. They should not have the same name.
 
Upvote 0

Forum statistics

Threads
1,191,273
Messages
5,985,691
Members
439,974
Latest member
sjoerdbosch

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
Top