View Single Post
  #4   Report Post  
BigIan
 
Posts: n/a
Default Write cell info to external file

Thanks for your help Stefi, I can't get it to work though. I get a 400 error
when I run it.
I'm not very well up in VB so this is just a guess, but does your code just
define the filename? I see pathname + filename from cell B1 but I don't see
where the cell content of A1 goes.
What I've done so far is to copy your code exactly on to a VB code box and
replace "pathname" with "c:\" (I left the quotation marks in) so it looks
like this:

Sub txtsave()
ActiveWorkbook.ActiveSheet.SaveAs Filename:= _
"c:\" & Range("B1"), FileFormat:=xlText, _
CreateBackup:=False
End Sub

Then I ran it as a macro. Do I need to change or add something else?

Thanks,
Ian

"Stefi" wrote:

Substitute "pathname" with your real pathname!

Sub txtsave()
ActiveWorkbook.ActiveSheet.SaveAs Filename:= _
"pathname" & Range("B1"), FileFormat:=xlText, _
CreateBackup:=False
End Sub


Regards,
Stefi

€˛BigIan€¯ ezt Ć*rta:

Is it possible to make an external file from the contents of a cell? For
example if I have "Text acbd" as the contents of cell A1, can I write it to a
new file called Text1.txt?
If so, can the file name Text1.txt be in another cell, B1 for example?
So, I've got A1 = "Text abcd", B1 = Text1.txt, is there a command or VB
routine that I can use to make a file called Txt1.txt with the contents "Text
abcd"?

Thanks,
Ian