Hi,
Please check the code in the attached file. I am trying to create a new workbook and copying entire content of sheet1 to new workbook.
Thanks in advance.
Regards,
Chandra Shekar
Hi,
Please check the code in the attached file. I am trying to create a new workbook and copying entire content of sheet1 to new workbook.
Thanks in advance.
Regards,
Chandra Shekar
[vba]
Dim fnm
fnm = Application.GetSaveAsFilename("", "Excel Files (*.xls), *.xls")
If IsNull(fnm) = True Then
MsgBox "File Name is Blank"
Else
Sheets("Sheet1").Copy
ActiveWorkbook.SaveAs fnm
End If
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Hi,
Thank you its working.
Regards,
Chandra Shekar
Hi,
How to check if file exists are not. If exists code should give error message that file already exists.
Thanks
Chandra Shekar
Exists, or is open?
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Hi,
I need code for both the option please.
Thanks
Chandra Shekar
[vba]
Public Sub DoubleCheck()
Const FILE_PATH As String = "C:\some directory\"
Const FILE_NAME As String = "somefile.xls"
Dim filename As String
filename = Dir(FILE_PATH & FILE_NAME, vbNormal)
If filename = "" Then
MsgBox FILE_PATH & FILE_NAME & " does not exist"
Else
If Not CBool(Workbooks(FILE_NAME) Is Nothing) Then
MsgBox FILE_NAME & " already open"
End If
End If
End Sub
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Hi,
How to apply this code with the previous code. Please let me know. I am new to VBA.
Thank you
Chandra Shekar
Hi,
Any suggestion xld.
Thanks
Chandra Shekar