Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using saveas twice will be error,savecopyas don't use also,why?

Option Explicit
Sub save()


Dim path As String
Dim MainTitle As String 'have got "new item",po and rekey po and so on.
Dim EndChar As String
Dim VendorNum As String
Dim VendorName As String
Dim ItemNum As String
Dim ItemDesc As String
Dim FinalFileName As String
Dim fName



'first fill the follow of value.
MainTitle = "NEW ITEM"
EndChar = Format(Date, "MMDDYY")
VendorNum = Range("A1")
VendorName = ""
ItemNum = Range("B1")
ItemDesc = ""
FinalFileName = MainTitle & VendorName & "_" & VendorNum & "_" & ItemDesc &
"_" & ItemNum & "_" & EndChar
path = ThisWorkbook.path & "\" & FinalFileName

'save file

On Error GoTo 123
ThisWorkbook.SaveAs (path)
Exit Sub
123:
fName = Application.GetSaveAsFilename
If fName = False Then Exit Sub
ThisWorkbook.SaveAs (fName) 'use twice will be error,why?
End Sub


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
SaveAs v. SaveCopyAs with Chinese in filename NickHK Excel Programming 0 December 8th 05 04:45 AM
Problems using SaveAs and SaveCopyAs PromisedOyster Excel Programming 0 July 20th 05 05:51 AM
error message with saveas DJA Excel Discussion (Misc queries) 6 February 17th 05 06:03 PM
SaveAs Error Steven K Excel Programming 1 September 17th 04 05:41 PM
Error on SaveAs Macro Kevin Excel Programming 1 December 3rd 03 03:58 AM


All times are GMT +1. The time now is 12:20 PM.

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"