View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
RobG RobG is offline
external usenet poster
 
Posts: 10
Default Simple macro needed to export a worksheet

Tom

Works like a dream - thanks!

Rob

"Tom Ogilvy" wrote:

There was a missing close paren on the fname statement.

I tested this and it worked fine:

Sub AA()
Do
fName = Application.GetSaveAsFilename( _
FileFilter:="Workbook Files (*.xls), *.xls")
Loop Until fName < False
ActiveWorkbook.SaveAs Filename:=fName, _
FileFormat:=xlWorkbookNormal

End Sub

--
Regards,
Tom Ogilvy

"RobG" wrote in message
...
Tom

I can't get this to work - I keep getting error messages about syntax

errors
or Compile error: Expected: expression. Any idea what I am doing wrong?

Rob

"Tom Ogilvy" wrote:

The dialog doesn't do the saving.

This command does:

ActiveWorkbook.SaveAs Filename:=fName

It should default to workbook, but to be absolutely sure

Do
fName = Application.GetSaveAsFilename( _
FileFilter:="Workbook Files (*.xls), *.xls"
Loop Until fName < False
ActiveWorkbook.SaveAs Filename:=fName, _
FileFormat :=xlWorkbookNormal

--
Regards,
Tom Ogilvy


"RobG" wrote in message
...

Andrea

This works great. In the Save As window it only gives me the option of

All
Files in the Save as type box. Is there a way of getting this to save

as
workbook, or am I trying to be too clever?

Regards

Rob

"Andrea Jones" wrote:

Here is some code that will do everything up until providing a Save

As
window
for you to enter the filename:

Sub expsheet()
Sheets("Sheet1").Select
Sheets("Sheet1").Copy
Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
ActiveWorkbook.SaveAs Filename:=fName
End Sub

Andrea Jones

"RobG" wrote:

Hi all

I need a simple macro to export one worksheet, including formulae,
values
and all formating, to a new workbook. Can anyone help me?

Rob