Macro Compile Error: Sub or Function Not defined

Jaspreet

New Member
Joined
Apr 30, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have been facing Compile Error for below code. Kindly help. Underlined portions of code are being highlighted.

Function TOOLSET_UPDATE(FCSN As String) As String
Dim i1 As Long
'Dim ColumnShift As Integer 'just to simplify code a bit...or may be opposite :)

Dim curTS As String
Dim curFC As String
Dim curSN As String
Dim tempFC As String
Dim fCell As Range
Dim rname As Range
Dim busizename As Range
Dim buname As Range
Dim tsize, tname As String

'Dim str1 As String

curSN = FCSN


Dim AttrTCN_FileCode As String
AttrTCN_FileCode = "textbox43"
Dim AttrTCN_SN As String
AttrTCN_SN = "textbox48"
Dim AttrTCN_ParentTS As String
AttrTCN_ParentTS = "textbox61"


Dim QTracToolCoundFilePath As String 'Path for file in current directory (where you open this macros), with unic name. Its temporary file only
Dim wwwXLMToolCouNT As String 'URL to QTRac Report

wwwXLMToolCouNT = Range("ToolCountLink").Value
'Generate filename for temporary file
QTracToolCoundFilePath = CreatePathFreeFileNameInCurrentFolder("AllToolCount_Tmp", "xml", False)
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
If that's the line that generates that message then it means the code has no idea what "CreatePathFreeFileNameInCurrentFolder" is. If it's not in your code project, spelled exactly like that then that's your issue. I suspect you copied the code from somewhere but didn't notice that procedure was also required.
Please post code within code tags (vba button on posting toolbar) to maintain indentation and readability.
N.B. tsize is a variant because it is not explicitly declared. That's not the reason for your problem - just thought you should be aware.
Personally I prefer to lump variable types together to minimize code lines, such as
VBA Code:
Dim curTS As String, curFC As String, curSN As String, tempFC As String
Dim buname As Range, [B]tsize As String[/B], tname As String, AttrTCN_FileCode As String
Dim AttrTCN_SN As String, AttrTCN_ParentTS As String
Dim fCell As Range, rname As Range, busizename As Range
but that's just me.
 
Upvote 0
Hi @Jaspreet.
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.​

The underlined line is a function and the error is because you are missing the code for that function.
You must go to where you got the function and copy all the code that exists there.
I don't know that code, so you have to go back to the place where you got the function and check that the "CreatePathFreeFileNameInCurrentFolder" function is there.
CreatePathFreeFileNameInCurrentFolder

--------------
I hope to hear from you soon.
Respectfully
Dante Amor
--------------
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top