View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Error Message: €˜Argument Not optional

The subroutine that Chip provided has this declaration header...

Public Sub ExportToTextFile(FName As String, _
Sep As String, SelectionOnly As Boolean, _
AppendData As Boolean)

Notice the four items in parentheses? They are required arguments that must
be provided when you call the subroutine. Chip describes what each one of
these arguments are in the text immediately above the code on his webpage.
You need to provide these arguments when you call the subroutine. The error
message you got is telling you the arguments you didn't provide are
required. The reason it used the wording "Argument not optional" is because
an argument can be designated as being Optional, in which case it could have
been left out of the subroutine call (but Chip did **not** do this with any
of his arguments; hence, they must all be provided).

Rick


"ryguy7272" wrote in message
...
This is probably something easy, but when you dont know what to do it is
hard. Basically, I copied Chips code form the following URL:

http://www.cpearson.com/excel/imptext.htm#Export

Then I run the code and the get an €˜Argument Not optional message. The
following line is tinted blue:
ExportToTextFile

I looked at some DG topics that discussed €˜Argument Not optional but didnt
get anywhere. I Googled the topic, and tried to figure out what is going
on...nothing jumped out at me. Basically, I didnt find anything that
seemed
helpful. I also looked under Tools References (I had my doubts about
this,
but tried it anyway). I clicked on Export 1.0 Type Library; it still
doesnt
work.

Typically, I am resourceful, and try to resolve issues by myself, but Ive
hit a wall, and dont know what to do now. I thought I was just starting
to
get somewhat proficient with this VBA stuff and then something that should
be
extremely simple (can you say copy/paste) vexes me. Can anyone offer some
insight or give me some kind of guidance

Thanks so much!

--
RyGuy