Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Shared worksheet saves blank files | Excel Discussion (Misc queries) | |||
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da | Excel Discussion (Misc queries) | |||
Saves worksheet as copy | Excel Discussion (Misc queries) | |||
Save As CSV saves empty rows | Excel Discussion (Misc queries) | |||
Can I run a macro/program when Excel saves worksheet? | Excel Programming |