+ Reply to Thread
Results 1 to 5 of 5

Macro-Save as

Hybrid View

  1. #1
    Lois
    Guest

    Macro-Save as

    I need to know how to 'default' the save file type as an .xls from a .dat
    within a macro. After a macro has completed changing many .dat files into
    excel spreadsheets to include subtotals, the file type is defaulted to .dat
    and when I go to save the file, I have to constantly change the file type
    from .dat to .xls.

  2. #2
    bigwheel
    Guest

    RE: Macro-Save as

    "Lois" wrote:

    > I need to know how to 'default' the save file type as an .xls from a .dat
    > within a macro. After a macro has completed changing many .dat files into
    > excel spreadsheets to include subtotals, the file type is defaulted to .dat
    > and when I go to save the file, I have to constantly change the file type
    > from .dat to .xls.


    Check the SaveAs method which allows you to specify the desired FileFormat
    e.g.
    ActiveWorkbook.SaveAs(test, fileFormat:=xlNormal)

  3. #3
    bigwheel
    Guest

    RE: Macro-Save as

    "bigwheel" wrote:

    > "Lois" wrote:
    >
    > > I need to know how to 'default' the save file type as an .xls from a .dat
    > > within a macro. After a macro has completed changing many .dat files into
    > > excel spreadsheets to include subtotals, the file type is defaulted to .dat
    > > and when I go to save the file, I have to constantly change the file type
    > > from .dat to .xls.

    >
    > Check the SaveAs method which allows you to specify the desired FileFormat
    > e.g.
    > ActiveWorkbook.SaveAs(test, fileFormat:=xlNormal)


    Sorry, bit of an error with the syntax above ...

    Try ActiveWorkbook.SaveAs FileFormat:=xlNormal

  4. #4
    Lois
    Guest

    RE: Macro-Save as

    Thanks, but I'm still having trouble. I probably wasn't very clear before.
    Here is the macro that we currently have and need to change to include
    'changing the file type from .dat to .xls. before we save the file.
    Any help is appreciated!!!

    SendKeys "%fa~"
    ActiveSheet.Outline.ShowLevels Rowlevels:=4
    Columns("B:E").Select
    Selection.EntireColumn.Hidden = True
    Columns("G:T").Select
    Selection.EntireColumn.Hidden = True
    ActiveSheet.PrintOut
    SendKeys "n~"
    ActiveWindow.Close
    End Sub



    "bigwheel" wrote:

    > "bigwheel" wrote:
    >
    > > "Lois" wrote:
    > >
    > > > I need to know how to 'default' the save file type as an .xls from a .dat
    > > > within a macro. After a macro has completed changing many .dat files into
    > > > excel spreadsheets to include subtotals, the file type is defaulted to .dat
    > > > and when I go to save the file, I have to constantly change the file type
    > > > from .dat to .xls.

    > >
    > > Check the SaveAs method which allows you to specify the desired FileFormat
    > > e.g.
    > > ActiveWorkbook.SaveAs(test, fileFormat:=xlNormal)

    >
    > Sorry, bit of an error with the syntax above ...
    >
    > Try ActiveWorkbook.SaveAs FileFormat:=xlNormal


  5. #5
    bigwheel
    Guest

    RE: Macro-Save as

    OK see if this helps. Change ActiveWindow.Close to

    a = ActiveWindow.Close(True,awName)

    Insert immediately above this, and all on one line, as follows:-

    awname = Left(ActiveWorkbook.Name, Application.WorksheetFunction.Find(".",
    ActiveWorkbook.Name) - 1) & ".xls"



    "Lois" wrote:

    > Thanks, but I'm still having trouble. I probably wasn't very clear before.
    > Here is the macro that we currently have and need to change to include
    > 'changing the file type from .dat to .xls. before we save the file.
    > Any help is appreciated!!!
    >
    > SendKeys "%fa~"
    > ActiveSheet.Outline.ShowLevels Rowlevels:=4
    > Columns("B:E").Select
    > Selection.EntireColumn.Hidden = True
    > Columns("G:T").Select
    > Selection.EntireColumn.Hidden = True
    > ActiveSheet.PrintOut
    > SendKeys "n~"
    > ActiveWindow.Close
    > End Sub
    >
    >
    >
    > "bigwheel" wrote:
    >
    > > "bigwheel" wrote:
    > >
    > > > "Lois" wrote:
    > > >
    > > > > I need to know how to 'default' the save file type as an .xls from a .dat
    > > > > within a macro. After a macro has completed changing many .dat files into
    > > > > excel spreadsheets to include subtotals, the file type is defaulted to .dat
    > > > > and when I go to save the file, I have to constantly change the file type
    > > > > from .dat to .xls.
    > > >
    > > > Check the SaveAs method which allows you to specify the desired FileFormat
    > > > e.g.
    > > > ActiveWorkbook.SaveAs(test, fileFormat:=xlNormal)

    > >
    > > Sorry, bit of an error with the syntax above ...
    > >
    > > Try ActiveWorkbook.SaveAs FileFormat:=xlNormal


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1