![]() |
Urgent help Runtime error ‘1004’ Method ‘SaveAs’ of object’-Workbook’ failed ?????
Hi A user has been receiving this error. I wanted to know if there is perhaps something that triggers this error message off. In my code it saves a workbook to the Floppy Drive (A:). I have asked the user to confirm that the disk is in the A: Drive which they confirmed. They have also tried another disk. I have excel 2000 and the user has excel 2003. I dont know if its perhaps a compatiblitie issue. Any advise much appreciates -- funkymonkUK ------------------------------------------------------------------------ funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135 View this thread: http://www.excelforum.com/showthread...hreadid=538783 |
Urgent help Runtime error €˜1004 Method €˜SaveAs of object-Workbo
Would it be possible to post the code that you are having problems with? Also
just out of curiosity do they have the same problem if they try and save the file to the PC hard drive rather than the floppy? "funkymonkUK" wrote: Hi A user has been receiving this error. I wanted to know if there is perhaps something that triggers this error message off. In my code it saves a workbook to the Floppy Drive (A:). I have asked the user to confirm that the disk is in the A: Drive which they confirmed. They have also tried another disk. I have excel 2000 and the user has excel 2003. I dont know if its perhaps a compatiblitie issue. Any advise much appreciates -- funkymonkUK ------------------------------------------------------------------------ funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135 View this thread: http://www.excelforum.com/showthread...hreadid=538783 |
Urgent help Runtime error ‘1004’ Method ‘SaveAs’ of object’-Workbook’ failed ?????
Heres my code which is attached to a button on a userform. unfortunately I will try to ask them to save it to PC but I would prefer it if they dont as this should be an automated procedure. Private Sub CommandButton1_Click() Sheets("data").Visible = True Sheets("data").Select Range("f1") = ComboBox1.Value Range("A7").Select Set exportfind = Cells.Find(What:="download", after:=Range("a7"), LookIn:=xlValues, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False) If ActiveCell.Row < 7 Then MsgBox ("There is no data for the month you have selected.") End If If exportfind Is Nothing Then MsgBox ("There is no data for the month you have selected.") Else MsgBox ("Please insert a floppy disk into the floppy drive and when you are ready to export click th OK button.") exportplace = Range("b3").Value exportname = Range("b2").Value exportmonth = Range("k1").Value exportfile = "A:\" & exportplace & "-" & exportmonth & "data.csv" Range("A7").Select Selection.AutoFilter Selection.AutoFilter Field:=12, Criteria1:="Download" Selection.CurrentRegion.Select Selection.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False Columns("L:L").Select Selection.Delete Shift:=xlToLeft Range("A1").Select Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:=exportfile, FileFormat:=xlCSV, _ CreateBackup:=False ActiveWindow.Close Selection.AutoFilter Application.DisplayAlerts = True Range("A7").Select 'email the data mainemail = Range("f2").Value Dim ol As Outlook.Application Dim ns As Outlook.NameSpace Dim newm As Outlook.MailItem Set ol = New Outlook.Application Set ns = ol.GetNamespace("MAPI") On Error Resume Next Set newm = ol.CreateItem(olMailItem) With newm To = mainemail ' email address to send to Subject = "Stats Return from " & exportname & "-" & exportmonth ' subject of the email Body = "Here are is our Return" ' message in the email With .Attachments.Add(exportfile) ' add the file i am using at present DisplayName = "Stats returns from " & exportplace End With Send End With Set ol = Nothing Set ns = Nothing Set newm = Nothing MsgBox ("Your data has been exported to " & mainemail & ".") End If Sheets("data").Visible = True End Sub -- funkymonkUK ------------------------------------------------------------------------ funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135 View this thread: http://www.excelforum.com/showthread...hreadid=538783 |
Urgent help Runtime error ‘1004’ Method ‘SaveAs’ of object’-Workbook’ failed ?????
wich values are in Range("b3").Value Range("b2").Value Range("k1").Value ? -- H.A. de Wilde ------------------------------------------------------------------------ H.A. de Wilde's Profile: http://www.excelforum.com/member.php...o&userid=30679 View this thread: http://www.excelforum.com/showthread...hreadid=538783 |
Urgent help Runtime error €˜1004 Method €˜SaveAs of object-Wo
Have your code save it to the hard drive, then copy it to the floppy. then
optionally delete it from the hard drive. -- Regards, Tom Ogilvy "funkymonkUK" wrote: Heres my code which is attached to a button on a userform. unfortunately I will try to ask them to save it to PC but I would prefer it if they dont as this should be an automated procedure. Private Sub CommandButton1_Click() Sheets("data").Visible = True Sheets("data").Select Range("f1") = ComboBox1.Value Range("A7").Select Set exportfind = Cells.Find(What:="download", after:=Range("a7"), LookIn:=xlValues, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False) If ActiveCell.Row < 7 Then MsgBox ("There is no data for the month you have selected.") End If If exportfind Is Nothing Then MsgBox ("There is no data for the month you have selected.") Else MsgBox ("Please insert a floppy disk into the floppy drive and when you are ready to export click th OK button.") exportplace = Range("b3").Value exportname = Range("b2").Value exportmonth = Range("k1").Value exportfile = "A:\" & exportplace & "-" & exportmonth & "data.csv" Range("A7").Select Selection.AutoFilter Selection.AutoFilter Field:=12, Criteria1:="Download" Selection.CurrentRegion.Select Selection.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False Columns("L:L").Select Selection.Delete Shift:=xlToLeft Range("A1").Select Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:=exportfile, FileFormat:=xlCSV, _ CreateBackup:=False ActiveWindow.Close Selection.AutoFilter Application.DisplayAlerts = True Range("A7").Select 'email the data mainemail = Range("f2").Value Dim ol As Outlook.Application Dim ns As Outlook.NameSpace Dim newm As Outlook.MailItem Set ol = New Outlook.Application Set ns = ol.GetNamespace("MAPI") On Error Resume Next Set newm = ol.CreateItem(olMailItem) With newm .To = mainemail ' email address to send to .Subject = "Stats Return from " & exportname & "-" & exportmonth ' subject of the email .Body = "Here are is our Return" ' message in the email With .Attachments.Add(exportfile) ' add the file i am using at present .DisplayName = "Stats returns from " & exportplace End With .Send End With Set ol = Nothing Set ns = Nothing Set newm = Nothing MsgBox ("Your data has been exported to " & mainemail & ".") End If Sheets("data").Visible = True End Sub -- funkymonkUK ------------------------------------------------------------------------ funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135 View this thread: http://www.excelforum.com/showthread...hreadid=538783 |
All times are GMT +1. The time now is 02:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com