View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ed Davis[_2_] Ed Davis[_2_] is offline
external usenet poster
 
Posts: 67
Default Passing text to VBA code

This is now the whole line of code and I am getting a syntax error on the
line.

ActiveWorkbook.SaveAs ThisWorkbook.Path & "\Backup\Sales\Work\"&inval&"(" &
strSH & ")" & Format(Now, " dd-mm-yy hh-mm-ss") & ".xls",
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False


--
Thank You in Advance
Ed Davis
"Stefi" wrote in message
...
Bob missed a " after inVal&:
ThisWorkbook.Path & "\Backup\Sales\Work\" &inVal& "(" & strSH & ")" &
Format(Now," dd-mm-yy hh-mm-ss") & ".xls"

Instead of
ThisWorkbook.Path & "\Backup\Sales\Work\" &inVal& (" & strSH & ")" &
Format(Now," dd-mm-yy hh-mm-ss") & ".xls"
Stefi


"Ed Davis" ezt írta:

I now have this code and I am getting a compile error on " & Format(Now,"
EXPECTED END OF STATEMENT.

ThisWorkbook.Path & "\Backup\Sales\Work\" &inVal& (" & strSH & ")" &
Format(Now," dd-mm-yy hh-mm-ss") & ".xls"

--
Thank You in Advance
Ed Davis
"Bob Phillips" wrote in message
...
Sub TopLevelMacro()
Dim var As String

var = "Before_I_Update"

Call Macro1(var)

Call macro2(var)

'etc
End Sub

Sub Macro1(inVal As String)
ThisWorkbook.Path & "\Backup\Loja\Work\" & inVal & (" & strSH & ")" &
Format(Now, " dd-mm-yy hh-mm-ss") & ".xls"
end sub

and so on

--
__________________________________
HTH

Bob

"Ed Davis" wrote in message
...
I have this line in several macros (7) to be exact.
Each one of these macros is called when another Macro is run (Changing
something on a sheet).
The macros are exactly the same except this line where this line says
"Before_I_Update"
Is there a way to pass "Before_I_Update" from the macro that is
calling
it?
That way I can have only 1 macro that runs this code and pass the
"string" to it.
BTW I have three workbooks with the same amount of macros with this
code.

ThisWorkbook.Path & "\Backup\Loja\Work\Before_I_Update (" & strSH &
")" &
Format(Now, " dd-mm-yy hh-mm-ss") & ".xls"

--
Thank You in Advance
Ed Davis