Hi
I have a data export from Access into Excel, 3 spreadsheets are exported, a master sheet (StatCompile) opens that takes data from the exported sheets, and a 'control' spreadsheet (ctlxlsStat) opens and has some code to print x number of copies of the master spreadsheet.
I have just converted everything to office 2010 and tweaked the code to change the file extensions.
I am now getting a runtime error saying: 'object doesn't support this property or method.
I initially thought this was a references problem, but the Excel and Office 14 references are selected.
I wanted to unselect them and re-add them, but it wont let me as it says the excel one is in use.
Does anyone have any ideas please. Here is the code (it runs from an excel form in ctlxlsStat where you enter the number of copies to print btw):
I've highlighted the probelm line. I have tried to re-add the line and the command select doesn't automatically come up in the list as i type, indicating again that its a reference library problem, i just cant work out how to fix it.
Thanks in advance.
Kev
I have a data export from Access into Excel, 3 spreadsheets are exported, a master sheet (StatCompile) opens that takes data from the exported sheets, and a 'control' spreadsheet (ctlxlsStat) opens and has some code to print x number of copies of the master spreadsheet.
I have just converted everything to office 2010 and tweaked the code to change the file extensions.
I am now getting a runtime error saying: 'object doesn't support this property or method.
I initially thought this was a references problem, but the Excel and Office 14 references are selected.
I wanted to unselect them and re-add them, but it wont let me as it says the excel one is in use.
Does anyone have any ideas please. Here is the code (it runs from an excel form in ctlxlsStat where you enter the number of copies to print btw):
Code:
Option Explicit
Dim i As Variant
Dim currentDir As String
Private Sub CommandButton1_Click()
currentDir = ActiveWorkbook.Path
'Workbooks.Open currentDir & "\CasesCurrent.xls"
Workbooks.Open currentDir & "\CasesOpened.xls"
Workbooks.Open currentDir & "\CasesClosed.xls"
Workbooks.Open currentDir & "\Actions.xls"
Workbooks.Open currentDir & "\StatCompile.xlsm"
[COLOR=red]Workbooks("statCompile.xlsm").Select[/COLOR]
Sheets("Summary").Select
For i = 1 To Printctl.TextBox1.Text
ActiveSheet.PrintOut
Next i
'Workbooks("CasesCurrent.xls").Close SaveChanges:=False
Workbooks("CasesOpened.xls").Close SaveChanges:=False
Workbooks("CasesClosed.xls").Close SaveChanges:=False
Workbooks("Actions.xls").Close SaveChanges:=False
'Workbooks("StatCompile.xlsm").Close SaveChanges:=True
'Kill currentDir & "\CasesCurrent.xls"
Kill currentDir & "\CasesOpened.xls"
Kill currentDir & "\CasesClosed.xls"
Kill currentDir & "\Actions.xls"
Workbooks("ctlxlsStat.xlsm").Close SaveChanges:=False
End Sub
Private Sub CommandButton2_Click()
currentDir = ActiveWorkbook.Path
'Kill currentDir & "\CasesCurrent.xls"
Kill currentDir & "\CasesOpened.xls"
Kill currentDir & "\CasesClosed.xls"
Kill currentDir & "\Actions.xls"
Workbooks("ctlxlsStat.xlsm").Close SaveChanges:=False
End Sub
I've highlighted the probelm line. I have tried to re-add the line and the command select doesn't automatically come up in the list as i type, indicating again that its a reference library problem, i just cant work out how to fix it.
Thanks in advance.
Kev