Results 1 to 10 of 20

Thread: HTML Code Test --post8798

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10

    Example VBIDE Microsoft Visual Basic for Applications Extensibility 5.3 For coding coding

    Code:
    Dim llCountLines As Long
    Dim ilSanityCheck As Integer
    Dim llEndLine As Long
    Dim procKind As Long
    'Set up a codepane object for where the cursor is in the sub.  For this example, where you placed it.  Setting a variable makes the code more readable and a mite shorter instead of using Application.VBE.ActiveCodePane all the time.
     Set olPane = Application.VBE.ActiveCodePane ' Setting a variable makes the code more readable and a mite shorter instead of using Application.VBE.ActiveCodePane all the time.
    ' GetSelection returns the position info for our selection and places those row and column numbers  in our chosen variables
     olPane.GetSelection Startline:=llSRow, startcolumn:=llSCol, Endline:=llERow, Endcolumn:=llECol
    ' This is a bit of a wierdo: ProcOfLine function returns the name of the Procedure for the given line. We can use for example the returned selection start row. The wierd thing is that the second srgument is returned to us, that is to say that returns the number VBA uses to identify the procedure type. For ProcBodyLine, ProcCountLines, and ProcStartLine, we need the procedure name. PocOfLine will return it.  For those functions, we also need to know the pk (procedure kind) or type.  ProcOfLine returns that as well.  In fact, it's the only procedure that will give us the proc type.  Once we have it, we can plug it into the other calls.  This makes where you put this call important.  It has to be before the calls that need procKind
     Let slProcName = olPane.CodeModule.ProcOfLine(llSRow, procKind) '
     Let llLine1 = olPane.CodeModule.ProcBodyLine(slProcName, procKind) ' Get the procedure "start" line: the line  on which the Declaration/Definition is for that procedure name, slProcName
     Let llCountLines = olPane.CodeModule.ProcCountLines(slProcName, procKind)  ' Get the count of lines in this procedure.  In this case  .....
     Let llStartLine = olPane.CodeModule.ProcStartLine(slProcName, procKind) ' Get the start line of the procedure.  In this case ...
     Let llEndLine = llStartLine + llCountLines - 1 ' this we calculate


    Code:
    Option Explicit
    Sub DumDim()
      For Cnt = 1 To 10
      
      Next Cnt
    Dim Cnt As Long
    End Sub


    Code:
    Sub DumDim()
    Dim Cnt As Long
      For Cnt = 1 To 3
            Dim Count As Long
            Count = Count + 1
        ' count value will be 3
      Next Cnt
     MsgBox Prompt:=Count: Debug.Print Count
    End Sub



    This must be correct Time Format
    This must be Correct Date Format
    Worksheet: BluePrint



    This must be correct Time Format
    This must be Correct Date Format


    Dim a! ' same as Dim a as Short
    Dim b@ ' same as Dim b as Currency
    Dim c# ' same as Dim c as Double
    Dim d$ ' same as Dim d as String
    Dim e% ' same as Dim e as Integer
    Dim f& ' same as Dim f as Long


    [Code]Dim a! ' same as Dim a as Short
    Dim b@ ' same as Dim b as Currency
    Dim c# ' same as Dim c as Double
    Dim d$ ' same as Dim d as String
    Dim e% ' same as Dim e as Integer
    Code:
    Dim strA As String, strB As String
    Dim lA As Long, Lr As Long
    ' Or maybe this ???
    Dim strA$, strB$
    Dim lA&, Lr&
    
    
    '
    '   https://bytes.com/topic/visual-basic/answers/643371-declaration-shortcuts
    '   https://stackoverflow.com/questions/28238292/declaring-variables-in-vba
    '   http://www.excelforum.com/excel-programming-vba-macros/1100751-excel-vba-to-copy-and-paste-from-horizontal-to-vertical-format-2.html#post4194972
    '   https://www.excelforum.com/excel-programming-vba-macros/1116127-avoiding-variants-multiple-declarations-per-line-assign-variants-to-all-but-last-variable.html#post4256569
    Dim a! ' same as Dim a as Short
    Dim b@ ' same as Dim b as Currency
    Dim c# ' same as Dim c as Double
    Dim d$ ' same as Dim d as String
    Dim e% ' same as Dim e as Integer
    Dim f& ' same as Dim f as Long


    '
    ' https://bytes.com/topic/visual-basic...tion-shortcuts
    ' https://stackoverflow.com/questions/...riables-in-vba
    ' http://www.excelforum.com/excel-prog...ml#post4194972
    ' https://www.excelforum.com/excel-pro...ml#post4256569
    Dim a! ' same as Dim a as Short
    Dim b@ ' same as Dim b as Currency
    Dim c# ' same as Dim c as Double
    Dim d$ ' same as Dim d as String
    Dim e% ' same as Dim e as Integer
    Dim f& ' same as Dim f as Long





    Code:
                    lnglProcCountLines, _
                    lnglModuleProcEndLine
    
    Stop ' You got stopped - now go up there and do a bit of harvesting
    ' ***********************************************************************
    End Sub

    _____ Workbook: NeuProAktuelleMakros.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    F
    G
    39
    40
    µg
    % Empholen
    41
    0
    42
    0
    Worksheet: Leith2
    Last edited by DocAElstein; 02-13-2019 at 01:44 AM.

Similar Threads

  1. Replies: 5
    Last Post: 06-10-2019, 10:14 PM
  2. This is a test Test Let it be
    By Admin in forum Test Area
    Replies: 6
    Last Post: 05-30-2014, 09:44 AM
  3. change table top row to a different colour with html code
    By peter renton in forum Excel Help
    Replies: 2
    Last Post: 02-17-2014, 08:08 PM
  4. Test
    By Excel Fox in forum Den Of The Fox
    Replies: 0
    Last Post: 07-31-2013, 08:15 AM
  5. Test
    By Excel Fox in forum Word Help
    Replies: 0
    Last Post: 07-05-2011, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •