Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Prompt user to save their file

I am trying to prompt the user to save their file.

Application.GetSaveAsFilename looks like the right window
that pops up but the file doesn't actually save.

I tried this: ActiveWorkbook.SaveAs(Filename:=fName)
thinking I could set up a variable but maybe I have the
syntax wrong because it is not working.

Any ideas?
Thanks,
Sharon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Prompt user to save their file

Hi Sharon,

You're correct - GetSaveAsFilename will only return the filename, if any,
the user selected; it won't actually save the file. So you have to do that:

Dim vPath As Variant

vPath = Application.GetSaveAsFilename(FileFilter:= _
"Microsoft Excel Files (*.xls), *.xls")

If vPath < False Then
ActiveWorkbook.SaveAs vPath
End If

--
Regards,

Jake Marx
MS MVP - Excel

Sharon wrote:
I am trying to prompt the user to save their file.

Application.GetSaveAsFilename looks like the right window
that pops up but the file doesn't actually save.

I tried this: ActiveWorkbook.SaveAs(Filename:=fName)
thinking I could set up a variable but maybe I have the
syntax wrong because it is not working.

Any ideas?
Thanks,
Sharon


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Prompt user to save their file

I see then, I don't need to use "Filename:=" if I'm using
a variable. Thanks so much!
One more question if you don't mind.
It's about "Dim vPath As Variant"
I'm still learning about variables - so I wonder is it
better to use Variant than String?
Thanks for the info -
Have a great weekend.
Sharon

-----Original Message-----
Hi Sharon,

You're correct - GetSaveAsFilename will only return the

filename, if any,
the user selected; it won't actually save the file. So

you have to do that:

Dim vPath As Variant

vPath = Application.GetSaveAsFilename(FileFilter:= _
"Microsoft Excel Files (*.xls), *.xls")

If vPath < False Then
ActiveWorkbook.SaveAs vPath
End If

--
Regards,

Jake Marx
MS MVP - Excel

Sharon wrote:
I am trying to prompt the user to save their file.

Application.GetSaveAsFilename looks like the right

window
that pops up but the file doesn't actually save.

I tried this: ActiveWorkbook.SaveAs(Filename:=fName)
thinking I could set up a variable but maybe I have the
syntax wrong because it is not working.

Any ideas?
Thanks,
Sharon


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Prompt user to save their file

The filename:= is optional--as long as you put the filename as the first
parameter.

Some people like it, some don't always use it. I think it makes it easier
reading code.

But Jake dimmed vPath as variant so that he could use it as a string (if the
user selected a file) or use it as a boolean (when he compared it to False).

Sharon wrote:

I see then, I don't need to use "Filename:=" if I'm using
a variable. Thanks so much!
One more question if you don't mind.
It's about "Dim vPath As Variant"
I'm still learning about variables - so I wonder is it
better to use Variant than String?
Thanks for the info -
Have a great weekend.
Sharon

-----Original Message-----
Hi Sharon,

You're correct - GetSaveAsFilename will only return the

filename, if any,
the user selected; it won't actually save the file. So

you have to do that:

Dim vPath As Variant

vPath = Application.GetSaveAsFilename(FileFilter:= _
"Microsoft Excel Files (*.xls), *.xls")

If vPath < False Then
ActiveWorkbook.SaveAs vPath
End If

--
Regards,

Jake Marx
MS MVP - Excel

Sharon wrote:
I am trying to prompt the user to save their file.

Application.GetSaveAsFilename looks like the right

window
that pops up but the file doesn't actually save.

I tried this: ActiveWorkbook.SaveAs(Filename:=fName)
thinking I could set up a variable but maybe I have the
syntax wrong because it is not working.

Any ideas?
Thanks,
Sharon


.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Prompt user to save their file

Oh I see. Sometimes I am so literal. I didn't try
filename:= variableName. I think it is easier to read
also.

Thanks for that note about using "Variant" so it could be
used as boolean when comparing to False. I didn't realize
that.
Thanks-
Sharon

-----Original Message-----
The filename:= is optional--as long as you put the

filename as the first
parameter.

Some people like it, some don't always use it. I think

it makes it easier
reading code.

But Jake dimmed vPath as variant so that he could use it

as a string (if the
user selected a file) or use it as a boolean (when he

compared it to False).

Sharon wrote:

I see then, I don't need to use "Filename:=" if I'm

using
a variable. Thanks so much!
One more question if you don't mind.
It's about "Dim vPath As Variant"
I'm still learning about variables - so I wonder is it
better to use Variant than String?
Thanks for the info -
Have a great weekend.
Sharon

-----Original Message-----
Hi Sharon,

You're correct - GetSaveAsFilename will only return the

filename, if any,
the user selected; it won't actually save the file. So

you have to do that:

Dim vPath As Variant

vPath = Application.GetSaveAsFilename(FileFilter:=

_
"Microsoft Excel Files (*.xls), *.xls")

If vPath < False Then
ActiveWorkbook.SaveAs vPath
End If

--
Regards,

Jake Marx
MS MVP - Excel

Sharon wrote:
I am trying to prompt the user to save their file.

Application.GetSaveAsFilename looks like the right

window
that pops up but the file doesn't actually save.

I tried this: ActiveWorkbook.SaveAs(Filename:=fName)
thinking I could set up a variable but maybe I have

the
syntax wrong because it is not working.

Any ideas?
Thanks,
Sharon

.


--

Dave Peterson

.



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
Prompt to save file Gloria Setting up and Configuration of Excel 2 May 4th 06 01:09 AM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Prompt user to select file with default file selected dialog Bruce Cooley Excel Programming 0 September 15th 03 06:43 AM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:19 PM


All times are GMT +1. The time now is 11:36 PM.

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

About Us

"It's about Microsoft Excel"