Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SaveAs v. SaveCopyAs with Chinese in filename | Excel Programming | |||
Problems using SaveAs and SaveCopyAs | Excel Programming | |||
error message with saveas | Excel Discussion (Misc queries) | |||
SaveAs Error | Excel Programming | |||
Error on SaveAs Macro | Excel Programming |