Link to home
Start Free TrialLog in
Avatar of Sheldon Livingston
Sheldon LivingstonFlag for United States of America

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.Path
    theFile = Application.ThisWorkbook.Path & "\" & 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.
Avatar of Haris Dulic
Haris Dulic
Flag of Austria image

What is  frmProject.txtProject? If it is folder than the "\" is needed to get to csv file?

Can you post the  code of the writeProjectLine  sub? Or excel?
Avatar of Sheldon Livingston

ASKER

I've requested that this question be deleted for the following reason:

Found a workaround
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!
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