Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Declare a class module in General Declarations


I have a class module that I want to use a few time in my VBA code. How
do I declare it in the General declarations of the current module:

General.Declarations
Option Explicit
?????????? declare clsMod here

Private Sub cmdProcessItem_Click()
Dim N As Integer, nCounter As Long, cStrin As String, lProcess As
Boolean, _
cMsg As String, _
aFiles(1) As String, cFilenme As String
For N = 0 To 1
lProcess = clsMod.OpenFile(aFiles(N))
if not lProcess Then Exit for
Next N
If lProcess Then
process the workbook that was opened
else
msgBox "File Not Opened"
end sub

Thanks...


--
Wilbur
------------------------------------------------------------------------
Wilbur's Profile: http://www.excelforum.com/member.php...o&userid=31826
View this thread: http://www.excelforum.com/showthread...hreadid=521496

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Declare a class module in General Declarations

Try something like

Dim C As Class1

Sub Init()
Set C = New Class1
' more code
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Wilbur"
wrote in message
...

I have a class module that I want to use a few time in my VBA
code. How
do I declare it in the General declarations of the current
module:

General.Declarations
Option Explicit
?????????? declare clsMod here

Private Sub cmdProcessItem_Click()
Dim N As Integer, nCounter As Long, cStrin As String, lProcess
As
Boolean, _
cMsg As String, _
aFiles(1) As String, cFilenme As String
For N = 0 To 1
lProcess = clsMod.OpenFile(aFiles(N))
if not lProcess Then Exit for
Next N
If lProcess Then
process the workbook that was opened
else
msgBox "File Not Opened"
end sub

Thanks...


--
Wilbur
------------------------------------------------------------------------
Wilbur's Profile:
http://www.excelforum.com/member.php...o&userid=31826
View this thread:
http://www.excelforum.com/showthread...hreadid=521496



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
WorkBook VS General Module Desert Piranha[_54_] Excel Programming 2 February 24th 06 03:41 AM
Declarations Procedure and Duplicate Declarations Neal Zimm Excel Programming 3 May 31st 05 01:01 AM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
how to declare a class module Kevin Excel Programming 5 July 15th 03 01:04 AM


All times are GMT +1. The time now is 09:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"