value of cell as filename

  • Thread starter Thread starter wouter
  • Start date Start date
W

wouter

Hi,

I want to use the value of cell B6 as record name.
in VB i've got the following line:

ActiveWorkbook.SaveAs Filename:="F:[VALUE CELL B6].txt", FileFormat _
:=xlText, CreateBackup:=False

So at the place [VALUE CELL B6]that value should be copied in. How do
I accomplish this in Excel VB without too much codelines?
Any suggestion welcome!

Wouter de Voogd
Amsterdam
 
ActiveWorkbook.SaveAs Filename:="F:" _
& activeworkbook.worksheets("sheet1").range("b6").value & ".txt", _
FileFormat:=xlText, CreateBackup:=False

This assumes that you have all the backslashes you need in that B6 cell.

(and change the sheet1 to the correct sheet name, too.)
Hi,

I want to use the value of cell B6 as record name.
in VB i've got the following line:

ActiveWorkbook.SaveAs Filename:="F:[VALUE CELL B6].txt", FileFormat _
:=xlText, CreateBackup:=False

So at the place [VALUE CELL B6]that value should be copied in. How do
I accomplish this in Excel VB without too much codelines?
Any suggestion welcome!

Wouter de Voogd
Amsterdam
 
Thanks Dave for your advice!

Wouter


Dave Peterson said:
ActiveWorkbook.SaveAs Filename:="F:" _
& activeworkbook.worksheets("sheet1").range("b6").value & ".txt", _
FileFormat:=xlText, CreateBackup:=False

This assumes that you have all the backslashes you need in that B6 cell.

(and change the sheet1 to the correct sheet name, too.)
Hi,

I want to use the value of cell B6 as record name.
in VB i've got the following line:

ActiveWorkbook.SaveAs Filename:="F:[VALUE CELL B6].txt", FileFormat _
:=xlText, CreateBackup:=False

So at the place [VALUE CELL B6]that value should be copied in. How do
I accomplish this in Excel VB without too much codelines?
Any suggestion welcome!

Wouter de Voogd
Amsterdam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top