edjohns
09-20-2012, 12:52 PM
hi
i'm trying to display a MsgBox which displays a workbook added and saved by a subroutine.
Sub ExportarIncidencia()
'
Dim new_report As Workbook
Dim user As String
Dim report_key As String
Dim folder As String
Dim success As String
report_key = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now)
folder = SelectFolder("Selecciona una carpeta:", "")
file_path = folder & user & report_key
Set new_report = Workbooks.Add()
new_report.SaveAs Filename:=file_path & ".xls"
' DO STUFF WITH ACTIVE AND NEW WORKBOOKS
ActiveWorkbook.Save 'newly created workbook
ActiveWorkbook.Close
Windows("Formas.xls").Activate
Range("A1").Select
success = MsgBox("Se ha exportado el archivo:" & new_report, vbOKOnly)
Set new_report = Nothing
End Sub
what i am trying to do is let the user know the name of the new file that was just created.
i am getting a "object required" error (on the 3rd line from the bottom)
can't figure out whats wrong with this
thanks a lot guys
i'm trying to display a MsgBox which displays a workbook added and saved by a subroutine.
Sub ExportarIncidencia()
'
Dim new_report As Workbook
Dim user As String
Dim report_key As String
Dim folder As String
Dim success As String
report_key = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now)
folder = SelectFolder("Selecciona una carpeta:", "")
file_path = folder & user & report_key
Set new_report = Workbooks.Add()
new_report.SaveAs Filename:=file_path & ".xls"
' DO STUFF WITH ACTIVE AND NEW WORKBOOKS
ActiveWorkbook.Save 'newly created workbook
ActiveWorkbook.Close
Windows("Formas.xls").Activate
Range("A1").Select
success = MsgBox("Se ha exportado el archivo:" & new_report, vbOKOnly)
Set new_report = Nothing
End Sub
what i am trying to do is let the user know the name of the new file that was just created.
i am getting a "object required" error (on the 3rd line from the bottom)
can't figure out whats wrong with this
thanks a lot guys