Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Where should I place Private Declare Function? in Sheet1.click?

  Asked By: Irma    Date: Nov 04    Category: MS Office    Views: 834
  

In the following code, I need to use two Private Declare Functions,
I tried to place them in front of Private Sub CommandButton1_Click()
inside Sheet1.click....But I got error. Where should I place them?


Private Declare Function PrintWindow Lib "user32" (ByVal hWnd As
Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub CommandButton1_Click()

.......
xx = FindWindow("Notepad", vbNullString)
.......
end sub

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Candace Foster     Answered On: Nov 04

I don't get an error  (Excel 2003). What error are you getting?

(each declare  statement was split over two lines. I assume
that they are each on one line in your code?)

 
Answer #2    Answered By: Jo Fowler     Answered On: Nov 04

I have resolved this problem. My mistake was that I did not put
Private Declare Function statements inside 'General'-
'(Declaration)'. In stead of that, I placed them above and near
===================
Private Sub CommandButton1_Click()
===================

 




Tagged: