Problem on exporting info to new file

jeffcrtra

New Member
Joined
Oct 21, 2010
Messages
10
Hey guys,
I've been dealing with this issue almost all day long. I created this macro enable excel file that when opens shows a calendar, the user choose the date, then shows the forecast spreadsheet, I inserted a export button on it, when the user clicks it, it makes a copy of the same file on xls format and request a preferred location, the problem that is somehow this new copy of the file contains the module and the calendar`s form inside; meaning when the end user open this new copy it request the date again when it should giving the fact it is an XLS file. Which makes no sense cause it is a single XLS file instead of a macro enable I'm using Excel 2007.
I will appreciate every reply and help on this topic.

Here's the code (only the module):
Code:
Sub export_xls()
'
'
    Sheets("Purchase order").Select
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
    Sheets("Prices table").Select
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Sheets("Purchase order").Select
    ActiveSheet.Shapes("Button 1").Select
    Application.CutCopyMode = False
    Selection.Delete
    Custname = Sheets("Purchase order").Range("B4").Value & "-"
    Cotdate = Sheets("Purchase order").Range("O3").Value
    Application.DisplayAlerts = False
        With Application.FileDialog(msoFileDialogFolderPicker)
        .Show
        If .SelectedItems.Count > 0 Then
            MsgBox .SelectedItems(1)
            Application.DisplayAlerts = False
        End If
    End With
    ActiveWorkbook.SaveAs Filename:="PurchaseOrder-" & Custname & Cotdate, FileFormat:=56
    Application.DisplayAlerts = False
    
End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,217,007
Messages
6,133,993
Members
449,851
Latest member
laamiejbrown

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top