Sheldon Livingston
asked on
VBA ByRef error
Anyone know why the code below doesn't work?
I have an Excel workbook with a form and a module.
The form contains a button that contains:
Application.Run "startExport"
In the module I have:
Private Sub startExport()
Dim thePath, theFile As String
thePath = Application.ThisWorkbook.P ath
theFile = Application.ThisWorkbook.P ath & "\" & frmProject.txtProject & "Import.csv"
writeProjectLine thePath, theFile
End Sub
The code gives a "ByRef argument type mismatch" error and highlights the variable "thePath" that is shown in bold above.
I have an Excel workbook with a form and a module.
The form contains a button that contains:
Application.Run "startExport"
In the module I have:
Private Sub startExport()
Dim thePath, theFile As String
thePath = Application.ThisWorkbook.P
theFile = Application.ThisWorkbook.P
writeProjectLine thePath, theFile
End Sub
The code gives a "ByRef argument type mismatch" error and highlights the variable "thePath" that is shown in bold above.
ASKER
I've requested that this question be deleted for the following reason:
Found a workaround
Found a workaround
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not sure if this "Award" will take given the pending delete status.
Not only did your post help with this situation, but it helped me avoid potential issues as well!
I have changed my "slimy hack" workaround.
Thank you!
Not only did your post help with this situation, but it helped me avoid potential issues as well!
I have changed my "slimy hack" workaround.
Thank you!
You're welcome and I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
Can you post the code of the writeProjectLine sub? Or excel?