View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mike[_119_] Mike[_119_] is offline
external usenet poster
 
Posts: 3
Default saveas and excel template

On Jun 12, 6:16 pm, Incidental wrote:
Hi Mike

not sure if this is what is causing your problem but i have tried the
code below in a worksheet change event and it is working, it didn't
however work unless i indicate which sheet to check cell B6

Option Explicit
Dim mname As String

Sub filesaveas()

mname = Sheets(3).Range("b6").Value
Application.Dialogs(xlDialogSaveAs).Show (mname)

End Sub

hope this helps

S


I've checked the procedures of the workbook and couldn't find the
saveas procedure. So I picked what looked closest to what I wanted to
do which is the beforesave procedure.
The save as dialog now shows my combination of cells like I wanted,
but unfortunately, when I hit save in the dialog, the dialog pops up
again. Any ideas?

Here's the code

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Dim pFileName As Variant
Dim docTitle As String
Dim docNumber As String
Dim revision As String

docNumber = Range("g5").Value
docTitle = Range("b6").Value
revision = Range("h5").Value

pFileName = docNumber & "-" & revision & "-" & docTitle

With Application
.Dialogs(xlDialogSaveAs).Show (pFileName)

End With

And thanks for giving me ideas.