#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Save As wk4

Hi,

A gentleman helped me yesterday and showed me how to do a save as with this
code:
'===================================
Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub
'======================

I now need to be able to save this file as a wk4 because this person needs
it that way. I thought I could just change the extension to wk4 above. I
did that and it saved it that way, but he was unable to open the file. I
have found that I need to choose the file type of wk4 rather than give it
that extension. Can someone help with code to change the file type to wk4 as
you would do in the drop down of the save as??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Save As wk4

How about recording a macro as you save a file in Lotus format, to get the
syntax?

--
Jim
"Aaron" wrote in message
...
| Hi,
|
| A gentleman helped me yesterday and showed me how to do a save as with
this
| code:
| '===================================
| Sub SaveWithDate()
| '
| Dim wb As Workbook
| Dim ws As Worksheet
| Dim varVal As Variant
| Dim strFileName As String
|
| Set wb = ActiveWorkbook
| Set ws = wb.Worksheets("$ Reference")
| varVal = ws.Range("C2").Value
|
| If IsDate(varVal) Then
| strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
| ".xls"
| Else
| strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
| ".xls"
| End If
| ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules"
| ActiveWorkbook.SaveAs Filename:=strFileName
|
|
| Set wb = Nothing
| Set ws = Nothing
|
| End Sub
| '======================
|
| I now need to be able to save this file as a wk4 because this person needs
| it that way. I thought I could just change the extension to wk4 above. I
| did that and it saved it that way, but he was unable to open the file. I
| have found that I need to choose the file type of wk4 rather than give it
| that extension. Can someone help with code to change the file type to wk4
as
| you would do in the drop down of the save as??


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,081
Default Save As wk4

FileFormat:=xlWK4


"Aaron" wrote:

Hi,

A gentleman helped me yesterday and showed me how to do a save as with this
code:
'===================================
Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub
'======================

I now need to be able to save this file as a wk4 because this person needs
it that way. I thought I could just change the extension to wk4 above. I
did that and it saved it that way, but he was unable to open the file. I
have found that I need to choose the file type of wk4 rather than give it
that extension. Can someone help with code to change the file type to wk4 as
you would do in the drop down of the save as??

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Save As wk4

Hi, I did try that, but did not know how to incorporate it in the given code.
I think I was missing some syntax??

"Duke Carey" wrote:

FileFormat:=xlWK4


"Aaron" wrote:

Hi,

A gentleman helped me yesterday and showed me how to do a save as with this
code:
'===================================
Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub
'======================

I now need to be able to save this file as a wk4 because this person needs
it that way. I thought I could just change the extension to wk4 above. I
did that and it saved it that way, but he was unable to open the file. I
have found that I need to choose the file type of wk4 rather than give it
that extension. Can someone help with code to change the file type to wk4 as
you would do in the drop down of the save as??

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,081
Default Save As wk4

ActiveWorkbook.SaveAs Filename:=strFileName, FileFormat:=xlWK4

"Aaron" wrote:

Hi, I did try that, but did not know how to incorporate it in the given code.
I think I was missing some syntax??




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Save As wk4

You can specify the fileformat on this line:


Aaron wrote:

Hi,

A gentleman helped me yesterday and showed me how to do a save as with this
code:
'===================================
Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub
'======================

I now need to be able to save this file as a wk4 because this person needs
it that way. I thought I could just change the extension to wk4 above. I
did that and it saved it that way, but he was unable to open the file. I
have found that I need to choose the file type of wk4 rather than give it
that extension. Can someone help with code to change the file type to wk4 as
you would do in the drop down of the save as??


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Save As wk4

Doh...

You can specify a file format on this line:

ActiveWorkbook.SaveAs Filename:=strFileName

Either look at VBA's help or record a macro when you save a test workbook as
..wk4.



Aaron wrote:

Hi,

A gentleman helped me yesterday and showed me how to do a save as with this
code:
'===================================
Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub
'======================

I now need to be able to save this file as a wk4 because this person needs
it that way. I thought I could just change the extension to wk4 above. I
did that and it saved it that way, but he was unable to open the file. I
have found that I need to choose the file type of wk4 rather than give it
that extension. Can someone help with code to change the file type to wk4 as
you would do in the drop down of the save as??


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM
when i save xls file, debug script is running and canno't save fil Imtiaz Excel Discussion (Misc queries) 1 July 16th 05 03:47 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM
Why system asks me to save change even after I call save method(VB.NET) steellock Excel Programming 2 April 27th 04 04:14 AM


All times are GMT +1. The time now is 05:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"