User form problem

  • Thread starter Thread starter Zairn
  • Start date Start date
Z

Zairn

I have made a userform, which works great. However i have a problem.

I would like the userform to only load up when the template file i
opened. I do not want it to load when saved workbook copies of th
template are opened.

The system I am creating is an invoice system, and thus the loading o
the userform is only necessary upon opening the template, not any othe
files.

Is this possible to do? Any help would be appreciated.
Thanks.

Z
 
Hi Zairn

You can check the Len of the Thisworkbook.path in the Macro.
A template have no path

Sub test()
If Len(ThisWorkbook.Path) = 0 Then
MsgBox "run the userform"
Else
MsgBox "do not open the userform"
End If
End Sub
 
Hi Zairn

It is a function that count the characters of the path in this case.
See the Excel help for more information
 
Back
Top