.xl01 file type

Kuledoode

New Member
Joined
May 11, 2019
Messages
13
I have a program that opens an existing workbook, adds a date to the name and saves it as a new file. The code says to save it as a .xlsm file type but it ends up as a .xl01 or a .xl04 or a .xl010 file type. Excel does not recognize this file type when attempting to open in explorer. I cannot find any information on this file type. Please assist!

Code:
Sub Check_File()

Dim File As String, DirFile As String


File = "Event and Conference Points Table " & Format(ActiveCell, "yyyy-mm-dd" & ".xlsm")
DirFile = "C:\Users\Jeff\LH Points\"


If Dir(DirFile & File) = "" Then
    Workbooks.Open FileName:=DirFile & "Event and Conference Points Table Template.xlsm"
    ActiveWorkbook.SaveAs FileName:=DirFile & File
Else
    Workbooks.Open FileName:=DirFile & File
End If
End Sub


Private Sub CommandButton1_Click()  'changes dates back 28 days
    Range("A3").Value = Range("G1")
End Sub


Private Sub CommandButton2_Click()  'changes dates forward 28 days
    Range("A3").Value = Range("H1")
End Sub


Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    Call Check_File
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
What happens if you change

Code:
ActiveWorkbook.SaveAs FileName:=DirFile & File

to

Code:
ActiveWorkbook.SaveAs FileName:=DirFile & File, FileFormat:= 52
 
Upvote 0
Before the save line add the line below and copy and paste in the thread what it produces in the Immediate Window.

Code:
Debug.Print DirFile & File

By the way I would change File as a variable name.
 
Upvote 0
From Immediate Window

C:\Users\Jeff\LH Points\Event and Conference Points Table 2019-05-21.xl05C:\Users\Jeff\LH Points\Event and Conference Points Table 2019-04-30.xl04
C:\Users\Jeff\LH Points\Event and Conference Points Table 2019-05-17.xl05
 
Upvote 0
What happens if you change this:
Code:
File = "Event and Conference Points Table " & Format(ActiveCell, "yyyy-mm-dd" & ".xlsm")
to this:
Code:
File = "Event and Conference Points Table " & Format(ActiveCell, "yyyy-mm-dd") & ".xlsm"
and add Mark's change from post #2 ?
 
Upvote 0
This:

File = "Event and Conference Points Table " & Format(ActiveCell, "yyyy-mm-dd" & ".xlsm"
DirFile = "C:\Users\Jeff\LH Points"


If Dir(DirFile & File) = "" Then
Workbooks.Open FileName:=DirFile & "Event and Conference Points Table Template.xlsm"
Debug.Print DirFile & File
ActiveWorkbook.SaveAs FileName:=DirFile & File, FileFormat:=52
 
Upvote 0
You didn't state whether it saved or not so what happens with the code below?

Code:
Sub Check_File()

Dim File As String, DirFile As String


File = "Event and Conference Points Table " & Format(Date, "yyyy-mm-dd") & ".xlsm"
DirFile = "C:\Users\Jeff\LH Points\"


If Dir(DirFile & File) = "" Then
    Workbooks.Open Filename:=DirFile & "Event and Conference Points Table Template.xlsm"
    'Debug.Print DirFile & File
    ActiveWorkbook.SaveAs Filename:=DirFile & File, FileFormat:=52
Else
    Workbooks.Open Filename:=DirFile & File
End If
End Sub

Which is basically what JoeMo put and if it errors try a manual saveas changing the filename to Event and Conference Points Table 2019-05-18 and let us know what message it gives.
 
Last edited:
Upvote 0
You're missing a close parentheses on the File line. And what does Debug.Print DirFile & File produce in the Immediate Window after you fix the File line?
 
Upvote 0
This Works
Thanks 1 000 000 for helping out a beginner

Code:
File = "Event and Conference Points Table " & Format(ActiveCell, "yyyy-mm-dd") & ".xlsm"DirFile = "C:\Users\Jeff\LH Points\"


If Dir(DirFile & File) = "" Then
    Workbooks.Open FileName:=DirFile & "Event and Conference Points Table Template.xlsm"
    ActiveWorkbook.SaveAs FileName:=DirFile & File, FileFormat:=52

Now the only thing I have to get is the date of the newly created file to show up in cell A2
File = "Event and Conference Points Table " & Format(ActiveCell, "yyyy-mm-dd") & ".xlsm"
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,114,002
Members
448,543
Latest member
MartinLarkin

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