yorkshirelad
Board Regular
- Joined
- Aug 18, 2003
- Messages
- 100
I have a large macro for which the first task is to activate an open csv file then copy and paste data into a master file before formatting and processing the data.
It works brilliantly on my office system and others pcs but when I email it to a colleague in another office ( the one who needs to use it) it doesn't get past the first stage as it doesn't find the file cliente.csv that we know is already open.
Having looked at a screenshot of her explorer, it looks as though the csv files on her system, are in a slightly different format to standard, which is why the macro does not find the file. On mine its a plain csv filr, on her's its a Microsoft Office Excel file of sort - I can't find out the actual extension as she's had to leave the office for the day and I need to get this sorted for first thing tomorrow.
As this could be a problem on other systems too, is there away of activating the Excel compatible workbook named 'cliente' regardless of the file format?
This is the start of the macro which I've saved seperately. Any help would be really appreciated, this has taken hours of work, including creating video tutorials - it would be really frustrating if it failed because it couldn't find the file that we know is open.
Sub SCD_importClienteData()
Application.ScreenUpdating = False
On Error Resume Next
Windows("cliente.csv").Activate
'Set src = Workbooks(file).Worksheets(1)
If Err.Number = 9 Then
MsgBox "You need to open the cliente.csv file you'd like to import"
Err.Clear
Exit Sub
ElseIf Err.Number <> 0 Then
MsgBox Err.Number & ":" & Err.Description
Err.Clear
Exit Sub
Else
' do nothing
End If
On Error GoTo 0
Application.CalculateFullRebuild
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveWindow.WindowState = xlMinimized
Sheets("ClienteSolicitar").Select
Application.CalculateFullRebuild
Dim FirstBlankCell As Range
Set FirstBlankCell = Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
FirstBlankCell.Activate
ActiveSheet.Paste
Range("A3").Select
ActiveWindow.WindowState = xlMaximized
End Sub
Many thanks again for any assistance.
It works brilliantly on my office system and others pcs but when I email it to a colleague in another office ( the one who needs to use it) it doesn't get past the first stage as it doesn't find the file cliente.csv that we know is already open.
Having looked at a screenshot of her explorer, it looks as though the csv files on her system, are in a slightly different format to standard, which is why the macro does not find the file. On mine its a plain csv filr, on her's its a Microsoft Office Excel file of sort - I can't find out the actual extension as she's had to leave the office for the day and I need to get this sorted for first thing tomorrow.
As this could be a problem on other systems too, is there away of activating the Excel compatible workbook named 'cliente' regardless of the file format?
This is the start of the macro which I've saved seperately. Any help would be really appreciated, this has taken hours of work, including creating video tutorials - it would be really frustrating if it failed because it couldn't find the file that we know is open.
Sub SCD_importClienteData()
Application.ScreenUpdating = False
On Error Resume Next
Windows("cliente.csv").Activate
'Set src = Workbooks(file).Worksheets(1)
If Err.Number = 9 Then
MsgBox "You need to open the cliente.csv file you'd like to import"
Err.Clear
Exit Sub
ElseIf Err.Number <> 0 Then
MsgBox Err.Number & ":" & Err.Description
Err.Clear
Exit Sub
Else
' do nothing
End If
On Error GoTo 0
Application.CalculateFullRebuild
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveWindow.WindowState = xlMinimized
Sheets("ClienteSolicitar").Select
Application.CalculateFullRebuild
Dim FirstBlankCell As Range
Set FirstBlankCell = Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
FirstBlankCell.Activate
ActiveSheet.Paste
Range("A3").Select
ActiveWindow.WindowState = xlMaximized
End Sub
Many thanks again for any assistance.