#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick fix


Hi,

Where have I gone wrong?

ActiveSheet.Protect "sports"
Application.GetSaveAsFilename ( _
InitialFileName:= "C:\R2\Sports Return\" & Format(Now(),
"dd_mm_yy") & "_sportsreturn"
FileFilter = "Microsoft Excel Workbook (*.xls), *.xls")
End Sub

I know im nearly there but I cant get the end of the macro right!!!1

Please help


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile: http://www.excelforum.com/member.php...o&userid=32143
View this thread: http://www.excelforum.com/showthread...hreadid=531827

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Quick fix

Cobbcouk,
You need to grab the return value, otherwise it's a useless call.
Dim FileName as Variant

FileName = Application.GetSaveAsFilename ( ....
'Check the user did not cancel
If FileName < False then
......

NickHK

"Cobbcouk" wrote in
message ...

Hi,

Where have I gone wrong?

ActiveSheet.Protect "sports"
Application.GetSaveAsFilename ( _
InitialFileName:= "C:\R2\Sports Return\" & Format(Now(),
"dd_mm_yy") & "_sportsreturn"
FileFilter = "Microsoft Excel Workbook (*.xls), *.xls")
End Sub

I know im nearly there but I cant get the end of the macro right!!!1

Please help


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile:

http://www.excelforum.com/member.php...o&userid=32143
View this thread: http://www.excelforum.com/showthread...hreadid=531827



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Quick fix

Sub test()
Dim fileName As String
ActiveSheet.Protect "sports"
fileName = Application.GetSaveAsFilename( _
InitialFileName:="U:\" & Format(Date, "dd_mm_yy") & "_sportsreturn", _
FileFilter:="Microsoft Excel Workbook (*.xls), *.xls" _
)
ActiveWorkbook.SaveAs fileName:=fileName
End Sub

HTH
--
AP


"Cobbcouk" a écrit
dans le message de
...

Hi,

Where have I gone wrong?

ActiveSheet.Protect "sports"
Application.GetSaveAsFilename ( _
InitialFileName:= "C:\R2\Sports Return\" & Format(Now(),
"dd_mm_yy") & "_sportsreturn"
FileFilter = "Microsoft Excel Workbook (*.xls), *.xls")
End Sub

I know im nearly there but I cant get the end of the macro right!!!1

Please help


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile:

http://www.excelforum.com/member.php...o&userid=32143
View this thread: http://www.excelforum.com/showthread...hreadid=531827



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick fix


Thanks for the quick response but im learning as i go with VBA. What d
you mean? And where should I write the filename? I kind of understan
the App.Get save as format but like I say, Im learnin

--
Cobbcou
-----------------------------------------------------------------------
Cobbcouk's Profile: http://www.excelforum.com/member.php...fo&userid=3214
View this thread: http://www.excelforum.com/showthread.php?threadid=53182

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Quick fix

Cobbcouk,
With my code FileName will be filled with the text enter in the appropriate
place on the dialog, assuming the user clicked OK instead of Cancel.
You then have do something with FileName, like .Save the file, as VBA does
not do this for you; it only provides an intuitive interface to get the
name/path.
So you still need:
ThisWorkbook.SaveAs FileName

Nick

"Cobbcouk" wrote in
message ...

Thanks for the quick response but im learning as i go with VBA. What do
you mean? And where should I write the filename? I kind of understand
the App.Get save as format but like I say, Im learning


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile:

http://www.excelforum.com/member.php...o&userid=32143
View this thread: http://www.excelforum.com/showthread...hreadid=531827





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Quick fix

To combine Nick's remarks with my solution, here is some code:

HTH
--
AP

'-------------
Sub test()
Dim fileName As String
ActiveSheet.Protect "sports"
fileName = Application.GetSaveAsFilename( _
InitialFileName:="U:\" & Format(Date, "dd_mm_yy") & "_sportsreturn", _
FileFilter:="Microsoft Excel Workbook (*.xls), *.xls" _
)
If fileName < False Then
ActiveWorkbook.SaveAs fileName:=fileName
End If
End Sub
'--------------

"NickHK" a écrit dans le message de
...
Cobbcouk,
With my code FileName will be filled with the text enter in the

appropriate
place on the dialog, assuming the user clicked OK instead of Cancel.
You then have do something with FileName, like .Save the file, as VBA does
not do this for you; it only provides an intuitive interface to get the
name/path.
So you still need:
ThisWorkbook.SaveAs FileName

Nick

"Cobbcouk" wrote in
message ...

Thanks for the quick response but im learning as i go with VBA. What do
you mean? And where should I write the filename? I kind of understand
the App.Get save as format but like I say, Im learning


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile:

http://www.excelforum.com/member.php...o&userid=32143
View this thread:

http://www.excelforum.com/showthread...hreadid=531827





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick fix


Many Thanks All

Its working only time will tell if the muppets using it will mess i
up!!!!!!!!!

Thanks again

:)Ga

--
Cobbcou
-----------------------------------------------------------------------
Cobbcouk's Profile: http://www.excelforum.com/member.php...fo&userid=3214
View this thread: http://www.excelforum.com/showthread.php?threadid=53182

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick help Helpmeeee Excel Worksheet Functions 7 October 14th 08 04:42 PM
Help quick nempo Excel Worksheet Functions 3 July 20th 06 10:22 PM
I need quick help please! Sutemi Charts and Charting in Excel 1 June 8th 06 08:51 AM
Quick question - quick answer about assigning shortcut keys funkymonkUK[_75_] Excel Programming 1 October 13th 05 10:50 AM
Quick VB Help April Excel Programming 4 January 14th 04 08:35 PM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"