Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help me please in open code of

Status
Not open for further replies.

milenman

MIS
Jul 15, 2006
1
DZ
hii guys
i have this save code i looking to open code of iut help soon please
that is it
---------------
Private Sub cmdSave_Click()
Dim frm As Form
Dim ctl As Control
Open "C:\DATAFROMFORMS.txt" For Output As #1
For Each frm In Forms
For Each ctl In frm.Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is Label Then
Print #1, frm.Name & ": " & ctl.Name & " - " & ctl
End If
Next
Next
Close #1
end sub
 
Shouldn't TextBox and Label be in quotes? Maybe I'm under the wrong impression..

-----------
Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a Microsoft MVP?
- Leonardo da Vinci
 
I was under the impression they were text. So good to know. :)

-----------
Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a Microsoft MVP?
- Leonardo da Vinci
 

I'm sure you've worked this out by now, Zack, but perhaps it will help someone else to clarify.

There are two different ways of checking the type of something - the TypeOf operator used within a condition as here which only works for Object Types and takes the Object Type Name (which is the Class Name for Used Defined Objects) and which is an identifier known to VBA and therefore unquoted - and the TypeName function which can be used anwhere and which returns a string and must therefore be compared to quoted string literals.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top