View Single Post
 
Old 08-30-2021, 02:35 AM
gorkac gorkac is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2021
Posts: 62
gorkac is on a distinguished road
Default

Hi Andrew, thanks for answering.
In Spanish, the word "etiqueta" is label in english.

VB6 :


VBA 7.1:




Well, the code
Code:
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
                                             ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Const speed As Byte = 1
Dim wid%
Dim hei%
Dim dc&
Const text = "       HELLO WORLD!!!       "
Private Sub Form_load()

dc = Picture1.hDC

  Picture1.CurrentX = 0
  Picture1.CurrentY = 0
  Picture1.Print text
  Picture1.ScaleMode = vbPixels
  wid = Picture1.TextWidth(text)
  hei = Picture1.TextHeight(text)
  Picture1.Width = wid * Screen.TwipsPerPixelX
  Picture1.Height = hei * Screen.TwipsPerPixelY
End Sub


Private Sub Timer1_Timer()
Dim i%


  For i = 0 To speed

    BitBlt dc, wid + 1, hei + 1, 1, hei, dc, 0, 0, &HCC0020 ' &hcc0020 is equvilent to vbSrcCopy
    BitBlt dc, 0, 0, wid, hei, dc, 1, 0, &HCC0020
    BitBlt dc, wid, 0, 1, hei, dc, wid + 1, hei + 1, &HCC0020

  Next i
    Picture1.Refresh


End Sub
run this:
Animation.gif

I NEED THIS !!!!!!!
The problem is that it is in vb6 code, which uses the Timer and I do not have it in vba 7.1.
It would be necessary to replace the timer Timer by another.
Reply With Quote