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
 
Back
Top