Macros not working in new SaveAs file

shigem_26

New Member
Joined
Sep 28, 2011
Messages
1
Hi
We are trying to run a macro (with dialogsheets and edit box) that was created sometime pre '97 in our 2003 version of excel.
at the end of the module ('97 version) there is the following code that uses

If OldDate <> NewDate Then
Range("E2") = Range("E2").Value + 1
Dim ck As Boolean
If newName = "" Then
str1 = "Enter New File Name Here"
Else
str1 = newName
End If
ck = Application.Dialogs(xlDialogSaveAs).Show(str1)
If ck = True Then
newName = ActiveWorkbook.Name
ActiveWorkbook.Close
End If

Endif

The intent is to save the exisiting workbook with a new name only if the date information stored in "E2" cell is updated to a value in next year (eg. Jan 1, 2012). The macro runs fine until this happen.
The macros in new saved file does not run. I get subscript out of range Error 9. On debugging the code seems to stop at the following line:

DialogSheets("Cell").EditBoxes("103").Text = "Anode to Cell Cover Voltage"
How do i fix this error?

Did the dialogsheet and the edit boxes get copied accurately when I saving through the code? I could save the files manually but wondering why the macro doesnt work.
Is this because the original file is a 97 version? If so what is the way around?

I am a new programmer so kindly bear with me if I haven't been clear with this posted questions.

Much appreciate any guidance.

Shigem

P.S. I code post the entire macro code if required. it is very long though
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top