Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Object not defined

Hi all,

This works

Dim debriefBook As Workbook

Sub booktest()
Set debriefBook = ThisWorkbook
MsgBox debriefBook.Name
End Sub

but if I call a function from a different module,

Sub ShowName
Set debriefBook = ThisWorkbook
ShowMe
End Sub

and this is in a different module!
Function Showme()
MsgBox debriefBook.Name
End Function
It doesnt work, it says "object not defined"
I'm not sure whats going on.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Object not defined

Marko,

Change the declaration of the variable to Public. I.e.,

Public debriefBook As Workbook


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


"marko" <no@email wrote in message
...
Hi all,

This works

Dim debriefBook As Workbook

Sub booktest()
Set debriefBook = ThisWorkbook
MsgBox debriefBook.Name
End Sub

but if I call a function from a different module,

Sub ShowName
Set debriefBook = ThisWorkbook
ShowMe
End Sub

and this is in a different module!
Function Showme()
MsgBox debriefBook.Name
End Function
It doesnt work, it says "object not defined"
I'm not sure whats going on.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Object not defined

Thanks Chip

"Chip Pearson" wrote in message
...
Marko,

Change the declaration of the variable to Public. I.e.,

Public debriefBook As Workbook


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


"marko" <no@email wrote in message
...
Hi all,

This works

Dim debriefBook As Workbook

Sub booktest()
Set debriefBook = ThisWorkbook
MsgBox debriefBook.Name
End Sub

but if I call a function from a different module,

Sub ShowName
Set debriefBook = ThisWorkbook
ShowMe
End Sub

and this is in a different module!
Function Showme()
MsgBox debriefBook.Name
End Function
It doesnt work, it says "object not defined"
I'm not sure whats going on.






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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Application-defined or object-defined error Please Help [email protected] Excel Discussion (Misc queries) 1 April 3rd 06 01:00 PM
Application-defined or object-defined error Sharon[_5_] Excel Programming 2 October 24th 03 03:49 PM
VBA - Application-defined or object-defined error tina salgia Excel Programming 0 August 24th 03 10:35 PM
VBA - Application-defined or object-defined error Chip Pearson Excel Programming 0 August 24th 03 08:43 PM


All times are GMT +1. The time now is 09:44 PM.

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"