Home > Software engineering >  A runtime error, the method failed SaveAs ACTS on the Workbook
A runtime error, the method failed SaveAs ACTS on the Workbook

Time:04-28

Don't know what went wrong, ask god to help modify, thanks!
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sub macro (1)
Dim I %, k As String, j As String, path As String, STR As String, ca1 As String

Path="E: \ JGY high-speed TJ9 \ embankment culvert back - compaction compaction degree information \ 96 \ \ a culvert Q1" & amp; "" 'choose to save the path
K=InputBox (" select start line ")
J=InputBox (" select end line ")
For I=k To j
Sheets (" report ") Cells (k, 15)=Sheets (" parameter ".) Cells (I + 1, 3)
STR=Sheets (" report "). The Cells (k, 15) & amp; ". XLSX "
Worksheets (Array (" report ", "record")). Copy the Copy 'report and record
Ca1=1
Do
Application. Calculation workbook=xlCalculationAutomatic 'automatic computing
Ca1=ca1 + 1
Loop While ca1 & lt; Set=7 'end loop condition

Sheets (" records "). Select
A11: U22 Range (" ")=Range (" A11: U22 "). The Value


ActiveWorkbook. SaveAs Filename:=path & amp; STR
ActiveWorkbook. Close SaveChanges:=True

Next I
MsgBox (" total "& amp; J - k + 1 & amp; "Report")
End Sub

CodePudding user response:

Seems to be the path="c: \ my documents" STR="666. XLS" result is c: \ my document 666. XLS
Or SAVEAS should be applied in the SHEETS
  •  Tags:  
  • VBA
  • Related