Excel 2013 macro enabled workbook not run on 2016 version

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Excel 2013 macro enabled workbook not run on 2016 version

Post by PRADEEPB270 »

There are 48 files which have created in 2013 excel version in macro enabled workbook.

Now I have shifted from 2013 to 2016 version.All files macro are not running in 2016.

Should I go back to 2013 version ?
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

Excel 2016 isn't very different from Excel 2013, so macros should - in theory - run.

Do you get an error message? If so, what does it say?
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12618
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by StuartR »

Are the Macros signed?
Are the Macros in a trusted location (check Options > Trust Center > Trust center settings > Trusted Locations)
What setting do you have in Options > Trust Center > Trust center settings > Macro Settings
Trust center settings.png
(This screenshot from Excel 2019)
You do not have the required permissions to view the files attached to this post.
StuartR


User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

When I press ALT+F8 then The code Appears on the screen and do not work.Is there any setting change required ?

Please mention step by step
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

I recommend making the folder or folders containing the workbooks a trusted location for Excel:
- Select File > Options.
- Select 'Trust Center'.
- Click the 'Trust Center Settings...' button.
- Select 'Trusted Locations'.
485762_image0.jpg
- If you want to make a folder on a network share a trusted location, tick the check box 'Allow Trusted Locations on my network (not recommended)'.
- Click 'Add new location...'.
- Click 'Browse...'.
- Select the folder, then click OK.
- If you want to make all subfolders of the selected folder a trusted location to, tick the check box 'Subfolders of this location are also trusted'.
- Click OK.
S3032.png
- Now select 'Macro Settings'.
- Select 'Disable all macros with notification'.
- Click OK.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

please check this attachment.only cost break-up macro is not working.

In 2013 all the macros are working but in excel 2016 some of the macro are not working.like this " Cost break-up" in this attachment.
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

The VBA project is locked with a password, so I cannot investigate it.
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

Sorry I have forget to remove the password.

Now please check
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

I have Excel 2019. The Costbreakup macro works correctly: it populates cells in columns K to O.
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

But on my laptop with excel version 2016 and windows 10 pro ,it is not running.

What will you suggest ?
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

Have you checked the Trust Center Settings, as suggested above?
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

Yes,all the macros are working except this i.e.cost break-up .

setting are ok.
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

Try the following:
- Comment out the following line by inserting an apostrophe ' at the beginning:

Code: Select all

   On Error GoTo lbl_err
- Run the Costbreakup macro.
- If you get an error message, please note what it says.
- Click Debug, and note which line is highlighted.
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & myWb.FullName & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes;"";"
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

What was the error message?
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

error:provider cannot be found.It may not be properly installed.
Regards

Pradeep Kumar Gupta
INDIA

User avatar
HansV
Administrator
Posts: 78569
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by HansV »

Does it work if you change

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & myWb.FullName & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes;"";"

to

cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & myWb.FullName & ";" & _
"Extended Properties=""Excel 12.0 Macro;HDR=YES"";"
Best wishes,
Hans

User avatar
PRADEEPB270
3StarLounger
Posts: 354
Joined: 27 Oct 2013, 15:11
Location: Gurgaon INDIA

Re: Excel 2013 macro enabled workbook not run on 2016 versio

Post by PRADEEPB270 »

Yes,now it is working well.

Thanks HansV for understanding my problem and provide best solution.Awesome help.
Regards

Pradeep Kumar Gupta
INDIA