M
Maja
Hi,
When I create a macro in Excel, and assign a button to it, it works
fine the first time, but when I re-open the workbook for a second
time, and try to run the macro again, the macro seems to refer to the
previous workbook...For some reason, the macro saves the name of the
previous workbook...
Sub test()
'
Dim name As String
Dim adress As String
Sheets("sheet1").Select
Range("A1").Select
name = ActiveSheet.Range("B6").Value
adress = ActiveSheet.Range("B4").Value
ActiveWorkbook.SaveAs Filename:="C:\WINDOWS\Desktop\Temp\" & name
& "_map" & adress & "_" & ".xls", FileFormat:=xlNormal, Password:="",
WriteResPassword:=""
MsgBox ("done")
End Sub
maybe somebody can help?
thanks in advance,
Maja
When I create a macro in Excel, and assign a button to it, it works
fine the first time, but when I re-open the workbook for a second
time, and try to run the macro again, the macro seems to refer to the
previous workbook...For some reason, the macro saves the name of the
previous workbook...
Sub test()
'
Dim name As String
Dim adress As String
Sheets("sheet1").Select
Range("A1").Select
name = ActiveSheet.Range("B6").Value
adress = ActiveSheet.Range("B4").Value
ActiveWorkbook.SaveAs Filename:="C:\WINDOWS\Desktop\Temp\" & name
& "_map" & adress & "_" & ".xls", FileFormat:=xlNormal, Password:="",
WriteResPassword:=""
MsgBox ("done")
End Sub
maybe somebody can help?
thanks in advance,
Maja