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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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