i'm getting the runtime 424 error when running this line of code:
dateOriginal = DateAdd(DateInterval.Day, dw, dateOriginal)
Does anyone has any idea of why is this error appearing?
Try the following
Substitute number for 1 as number of days
DateAdd("d",1, dateOriginal)
Related
I am trying to put a graphic file into a UserForm Image in VBA. Using the code below
UserForm1.Image1.Picture = "d:\Missionary\Mexico\Daisy Marlene Olivares.bmp"
I get the error
"Compile Error: Type mismatch".
I know that the file path is correct.
Modifying the code to the following
UserForm1.Image1.Picture = LoadPicture("d:\Missionary\Mexico\Daisy Marlene Olivares.bmp")
I get the error
"Compile Error: Sub or Function not defined"
I suspect that part of the reason for this error is because the image control is not ActiveX.
Can anyone help?
You need to reference OLE Automation for the LoadPicture function.
I have code that prints specific views to pdf using a specific fromDate and ToDate. My code started failing when I updated to ms Project 2016. Any ideas?
I've even tried removing the FromDate and ToDate and still get the error. When I add a watch to DocumentExport the Saveas dialog is displayed with the wrong filename, meaning the filename I am passing is not correct.
ViewApplyEx Name:="Gantt Employee", ApplyTo:=0 'view name
DocumentExport FileName:="C:\Schedules\test.pdf",FromDate:=printDate, ToDate:=printDateEnd
Run-time error '1004': Application-defined or object-defined error
Realized I didn't have the latest office 365 build due to being on the semi-annual update channel. I switched to the monthly channel updates and the problem was fixed.
As far as I can tell, there is nothing in VBA that tells you what line you are on or at what line an error has occurred. Is there some way to get the line number like there is in Visual Basic, ie
Dim CurrentStack As System.Diagnostics.StackTrace
lineNo = CurrentStack.GetFrame(0).GetFileLineNumber
How can one adapt this code for VBA?
erl will give you the error line number but only if you have added line numbers to your code, either manually or using an add-in like MZ Tools.
I'm using the brazilian-portuguese version of Excel on a Windows 7 also pt-BR.
I have a spreadsheet that I use for months in the same machine, same excel version, same etc. and a vba code that worked until today. As far as I know I have changed nothing.
The code was: Range("tabReport[[#All],[Valor]]")
Today when i ran the macro it gave me an error: Run-time error '1004': Method 'Range' of object '_Global' failed
After several trial and error I corrected to: Range("tabReport[[#Tudo];[Valor]]")
Notes:
1) "Tudo" is "All" translated to pt-BR.
2) Comma "," became semicolon ";", the equivalent in pt-BR local syntax.
What bugs me is this change from nowhere, that could affect other workbooks.
Also I prefer mantain my macro in USA English (Global) syntax mode, so it's easier to google and mantain.
Anyone have a clue about how can I control this behavior?
I'm trying to run a VBA / Excel program on 2 different pc's.
One is with the dutch version of Excel (VB 7) and one with the english one (VB 6.5).
When i try to run a function, i get the error:
Run-time error '32809':
Application-defined or object-defined error
When i strip down all code to just displaying a msgbox, the error still persists.
When i create a new tab, that tab can execute code.
I suppose this has something to do with wrong translation?
Any help on this?
Thanks!
Problem solved:
Store you excel file as .xls and not as .xlsm
Thanks team :)