Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Very Strange Error when using Format()


Guys,

This is a new one to me anyways. I was wondering if anyone could she
any light on it for me. This has to be the simplest piece of vb cod
ever, and it works in another workbook no questions asked!!???


Code
-------------------

Dim fmtDate As String

fmtDate = Format(Date, "mmm-yy")

-------------------


When I compile the code I get the if highlights *Format* and I get the
following error

Compile Error:
Wrong number of arguments or invalid property assignment

What the hell am I doing wrong? As I said, same version of exce
different workbook this works fine... as it should.

Thanks,
Lia

--
wjoc
-----------------------------------------------------------------------
wjoc1's Profile: http://www.excelforum.com/member.php...fo&userid=1528
View this thread: http://www.excelforum.com/showthread.php?threadid=47469

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Very Strange Error when using Format()

Liam,
I had no problem using your line of code: fmtDate = Format(Date,
"mmm-yy")

But you could try 'Now()' instead of 'Date'
E.G.
fmtDate = Format(Now(), "mmm-yy")

Peter

"wjoc1" wrote in
message ...

Guys,

This is a new one to me anyways. I was wondering if anyone could shed
any light on it for me. This has to be the simplest piece of vb code
ever, and it works in another workbook no questions asked!!???


Code:
--------------------

Dim fmtDate As String

fmtDate = Format(Date, "mmm-yy")

--------------------


When I compile the code I get the if highlights *Format* and I get the
following error

Compile Error:
Wrong number of arguments or invalid property assignment

What the hell am I doing wrong? As I said, same version of excel
different workbook this works fine... as it should.

Thanks,
Liam


--
wjoc1
------------------------------------------------------------------------
wjoc1's Profile:
http://www.excelforum.com/member.php...o&userid=15281
View this thread: http://www.excelforum.com/showthread...hreadid=474691



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Very Strange Error when using Format()

Do you have a global or procedure variable named Date that's overriding
the Date method?

Or your own Format method?

In article ,
wjoc1 wrote:

This is a new one to me anyways. I was wondering if anyone could shed
any light on it for me. This has to be the simplest piece of vb code
ever, and it works in another workbook no questions asked!!???


Code:
--------------------

Dim fmtDate As String

fmtDate = Format(Date, "mmm-yy")

--------------------


When I compile the code I get the if highlights *Format* and I get the
following error

Compile Error:
Wrong number of arguments or invalid property assignment

What the hell am I doing wrong? As I said, same version of excel
different workbook this works fine... as it should.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Very Strange Error when using Format()


Pete,

I've tried things like that and it doesn't do any good. It's a reall
wierd one, I have the same code in other workbooks and it works fine,
wonder has this workbook I'm working in become correupted or something/

Lia

--
wjoc
-----------------------------------------------------------------------
wjoc1's Profile: http://www.excelforum.com/member.php...fo&userid=1528
View this thread: http://www.excelforum.com/showthread.php?threadid=47469

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Very Strange Error when using Format()


JE,

That's it. The new workbook I tried to use this in was very complex and
hidden away in a litle corner of it was a Format() method. Ha ha.


Thanks a million,
Liam


--
wjoc1
------------------------------------------------------------------------
wjoc1's Profile: http://www.excelforum.com/member.php...o&userid=15281
View this thread: http://www.excelforum.com/showthread...hreadid=474691



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Very Strange Error when using Format()

Liam
I' m having the same problem with
"Wrong number of arguments or invalid property assignment" on the word
"Format" in the following code:
txtDate.Text = Format(Date, "mm/dd/yy")
similar to your
fmtDate = Format(Date, "mmm-yy")
(A difference is that I don't have anything like "Dim fmtDate As String
"). But what do you mean by a Format() method "hidden away in a little
corner" of the workbook? Or, if anyone else knows what else could be
causing the problem, I would appreciate the assistance
John





--------------------


When I compile the code I get the if highlights *Format* and I get the
following error


Compile Error:

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
strange error martinbarnes Excel Discussion (Misc queries) 3 April 1st 08 09:02 PM
strange error AD108 Excel Worksheet Functions 7 August 9th 06 09:22 AM
Strange error Andy Setting up and Configuration of Excel 1 April 18th 06 08:11 PM
Very strange error superkopite Excel Discussion (Misc queries) 3 February 19th 06 11:21 AM
Strange error Filips Benoit Excel Programming 7 October 20th 04 08:02 PM


All times are GMT +1. The time now is 04:12 PM.

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

About Us

"It's about Microsoft Excel"