PDA

View Full Version : Excel VBA - causing issues



liamg67
05-25-2021, 02:56 AM
HI
I have written some reports for work using VBA. For some reason the report causes crashes on other versions of Excel -

Crashes on Excel 2016 and earlier version yet runs on my Office 365.

The second issue affecting my machine is that after scripts run sometimes it does not allow me to delete lines including VBA row.delete and in the worksheet after script has run. This also then affects the ability to do same in other workbooks if they are open.

The reports take a handful of reports some from Connection using tables and other from copy and paste from other Excel files that are saved to a directory daily.
I am not sure what is causing this error and have tried Google searches.

Has anyone any knowledge of this and if it a corruption or a coding issue.
Used to have a Sort error come up when I opened files which I have solved using sort.fields clear command.
When the sort error came up I was able to clear the error but had to resave file as a new name.
Possibly this is related.

Any advice welcome and appreciated.

SamT
05-25-2021, 07:10 AM
365 is different from offline versions of Office. You may have to write two sets of code using Compiler Directives

#If [365] Then 'Compile this code
Some code
#Else 'Compile this other code
Some other code
#End If

I don't do 365, so other than that, I can't be of help. Hopefully someone smarter than I will chime in. It will help them if you post some of the troublesome code here.

liamg67
06-22-2021, 07:31 AM
Thanks - I can get my scripts to work - but for some reason I can not then delete rows in my worksheets after the script has run

SamT
06-22-2021, 11:40 AM
Oh. We will definitely need to see the code.