dirtyamaha
New Member
- Joined
- Aug 14, 2014
- Messages
- 2
I am relatively new to vba programming. I've figured out a number of things but this has me stumped.
This is what I am trying to do from a workbook where I have the vba code:
1) open a second workbook located elsewhere
2) save into another location
3) run some code on this second workbook
When I run the saveas, I get the 1004 error about the chart dimensions. At this point in the code, I haven't changed anything in the second workbook. This workbook does have a number of charts but if I save this manually, it does not have a problem.
I'm on excel 2010. I'm not sure what this is created on but the second workbook that is opened has no code in it. It was saved as a .xlsm by the guy who made it because he used an old workbook as a starting point.
Here is the snippet of code that opens and saves the workbook. I can post more if it would be helpful.
The lines for adding a chart were part of my attempt to create a new chart to establish a default chart type.
Please help if you can. I don't know where to go from here.
This is what I am trying to do from a workbook where I have the vba code:
1) open a second workbook located elsewhere
2) save into another location
3) run some code on this second workbook
When I run the saveas, I get the 1004 error about the chart dimensions. At this point in the code, I haven't changed anything in the second workbook. This workbook does have a number of charts but if I save this manually, it does not have a problem.
I'm on excel 2010. I'm not sure what this is created on but the second workbook that is opened has no code in it. It was saved as a .xlsm by the guy who made it because he used an old workbook as a starting point.
Here is the snippet of code that opens and saves the workbook. I can post more if it would be helpful.
Code:
'open template Application.Calculation = xlManual
Workbooks.Open (TempPath & "\Template " & Cells(i, 2).Text & ".xlsm")
'add a chart to set default charttype
Set WS = Sheets.Add
Set chtTemp = Charts.Add
With chtTemp
.ChartType = xlLine
.SetSourceData source:=WS.Range("A1:B10")
'Set chtTemp = WS.Shapes.AddChart(xlColumnClustered, 1, 1, 100, 100).Chart
End With
ActiveWorkbook.Saved = True
ActiveWorkbook.SaveAs Filename:=SavePath & CltName & "\Performance\" & FirstName & " " & AcctType & _
" " & TemplateType & ".xlsm", FileFormat:=52
The lines for adding a chart were part of my attempt to create a new chart to establish a default chart type.
Please help if you can. I don't know where to go from here.