Save file as????????????????????????????

Dejan

New Member
Joined
Oct 18, 2002
Messages
24
Need to save workbook as:
H16 = Number of document
A4 = Type of document
O2 = Date of document

I've tried like this but it doesn't work.

ActiveWorkbook.SaveAs Filename:="C:Pekara20021 & Range("H16").Value & Range("A4").Value & Format(Range("O2"), "dd.mm.yyyy")


Please help me
Thnx
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Richie(UK)

MrExcel MVP
Joined
May 17, 2002
Messages
3,329
Hi Dejan,

How about something along these lines?<pre>Sub SaveAsSub()
Dim MyName As String

MyName = "C:My Documents" & Range("H16").Value & _
Range("A4").Value & Format(Range("O2"), "dd.mm.yyyy") & ".xls"

MsgBox "About to save as:" & vbLf & MyName

ActiveWorkbook.SaveAs FileName:=MyName

End Sub</pre>
I changed the initial part to "My Documents" just for testing. Swap it back to your chosen directory.

HTH

PS. When posting to the board, rather than saying "I've tried like this but it doesn't work." try to clarify the nature of the problem. Does it produce an error message (if so, what is it)? Does it crash Excel? :wink:

EDIT: Oops - forgot my closing pre statement after the code. Doh!

_________________<font color="blue"> «««<font color="red">¤<font color="blue"><font size=+1>Richie</font><font color="red">¤<font color="blue"> »»»</font>

caffeine_sample.gif
</gif>
This message was edited by Richie(UK) on 2002-10-19 11:20
 

Forum statistics

Threads
1,144,264
Messages
5,723,326
Members
422,493
Latest member
RobF2112

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top