Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default GetSaveAsFileName saves empty worksheet

I have a file that I will be downloading daily from a website, formatting it,
then uploading it to another application. I've written the VBA code to do
the formatting, but when I get to the GetSaveAsFileName command, it saves the
blank "personal" worksheet instead of the one I just formatted. I understand
that it's because I have the module written in the "personal" worksheet,
where I chose to place it because I will be working with a new file every
day. Can you offer suggestions on the best way to save the active worksheet
with the data? The worksheet will be named according to the value in cell
a2, which is actually a date in text format.

Thanks again for your assistance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default GetSaveAsFileName saves empty worksheet

Jenny,

As far as I can tell you just have to make sure you are referencing the
right file to save. This might help:

'this is in your personal.xls
Option Explicit
Sub SaveOtherBook()
Dim vFile As Variant
Dim wbToSave As Workbook
vFile = Application.GetSaveAsFilename
If vFile = False Then Exit Sub
vFile = vFile & "xls"
Set wbToSave = Workbooks(ThisWorkbook.Sheets(1).Cells(2, 1).Value)
Application.DisplayAlerts = False
wbToSave.SaveAs CStr(vFile)
Application.DisplayAlerts = True
End Sub

Robin Hammond
www.enhanceddatasystems.com

"Jenny Barker" wrote in message
...
I have a file that I will be downloading daily from a website, formatting
it,
then uploading it to another application. I've written the VBA code to do
the formatting, but when I get to the GetSaveAsFileName command, it saves
the
blank "personal" worksheet instead of the one I just formatted. I
understand
that it's because I have the module written in the "personal" worksheet,
where I chose to place it because I will be working with a new file every
day. Can you offer suggestions on the best way to save the active
worksheet
with the data? The worksheet will be named according to the value in cell
a2, which is actually a date in text format.

Thanks again for your assistance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default GetSaveAsFileName saves empty worksheet

...when I get to the GetSaveAsFileName command,
it saves the blank "personal" worksheet ...


GetSaveAsFileName doesn't actually Save anything.
All it does is return a filename. It's then up to you to use that filename
for whatever you wish. Typically, you'd use it to specify the filename
argument of the Save or SaveAs methods.


Regards,
Vic Eldridge



"Jenny Barker" wrote:

I have a file that I will be downloading daily from a website, formatting it,
then uploading it to another application. I've written the VBA code to do
the formatting, but when I get to the GetSaveAsFileName command, it saves the
blank "personal" worksheet instead of the one I just formatted. I understand
that it's because I have the module written in the "personal" worksheet,
where I chose to place it because I will be working with a new file every
day. Can you offer suggestions on the best way to save the active worksheet
with the data? The worksheet will be named according to the value in cell
a2, which is actually a date in text format.

Thanks again for your assistance!

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
Shared worksheet saves blank files Lindaloutx Excel Discussion (Misc queries) 0 November 3rd 09 06:10 PM
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Saves worksheet as copy Bead Excel Discussion (Misc queries) 1 November 19th 08 04:00 PM
Save As CSV saves empty rows Garrett Excel Discussion (Misc queries) 3 February 18th 05 12:18 AM
Can I run a macro/program when Excel saves worksheet? TerryM Excel Programming 1 October 6th 04 12:23 PM


All times are GMT +1. The time now is 08:09 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"