Hi,
I am trying to close a workbook in excel using vba. I am copying data from one workbook to another and then attempting to close the original workbook i.e. copying data from "SearchResults" to "VBA_Test_Code".
Here is the code i am using;
I am able to close "SearchResults" without the "save changes" window popping up but the clipboard msgbox pops up as well.
I do not know how much data is going to be in "SearchResults.csv" which is why i am using the "Cells.Select" command.
Is there a command to suppress the clipboard msgbox in vba? If not how would i work around the problem?
Thanks in advance,
Crunchie
I am trying to close a workbook in excel using vba. I am copying data from one workbook to another and then attempting to close the original workbook i.e. copying data from "SearchResults" to "VBA_Test_Code".
Here is the code i am using;
Code:
Workbooks.OpenText Filename:="C:\SearchResults.csv", _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 1), Array(24, 1), Array(25, 1), Array(45, 1)), TrailingMinusNumbers:=True
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("VBA_Test_Code").Activate
Sheets("Results").Select
ActiveSheet.Paste
Workbooks("SearchResults").Close savechanges:=False
...
I am able to close "SearchResults" without the "save changes" window popping up but the clipboard msgbox pops up as well.
I do not know how much data is going to be in "SearchResults.csv" which is why i am using the "Cells.Select" command.
Is there a command to suppress the clipboard msgbox in vba? If not how would i work around the problem?
Thanks in advance,
Crunchie
Last edited: