Formdaki
Sub FontuYukle()
Dim Evn, Font As Object
Const fonts = &H14&
Set Evn = CreateObject("Shell.Application")
Set Font = Evn.Namespace(fonts)
Font.copyhere Environ("TEMP") & "\GeciciBarkod\ean13.ttf"
End Sub
Sub FontIndirveYukle()
On Error Resume Next
Dim GKlasor As String
Dim Mesaj As Integer
GKlasor = Environ("TEMP") & "\GeciciBarkod\"
MkDir (GKlasor)
DownloadFileFromWeb
FontuYukle
Kill GKlasor & "*.*"
RmDir (GKlasor)
Mesaj = MsgBox("Barkod Fontu yüklendi. Uygulama Kapanıp tekrar açılacak.", vbInformation + vbOKOnly)
If Mesaj = vbOK Then
DuzenleOnarYenile
End If
End Sub
kodları fontu indirir ve yükler.
Modüldeki
#If VBA7 Then
Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
#Else
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
#End If
Sub DownloadFileFromWeb()
Dim myFile As String
Dim Ret As Long
Dim strSavePath As String
Dim URL As String
URL = "https://accesstr.net/sitegenel/ean13.ttf"
strSavePath = Environ("TEMP") & "\GeciciBarkod\ean13.ttf"
Debug.Print strSavePath
Ret = URLDownloadToFile(0, URL, strSavePath, 0, 0)
If Ret = 0 Then
Exit Sub
Else
MsgBox "Dosya Yüklenemedi"
End If
End Sub
Kodu fontu temp dizinine kaydeder.