Questions tagged [vba7]

Visual Basic for Applications (VBA) is an event-driven, object-oriented programming language for writing macros, used for the MS Office suite as well as other applications. VBA is not equivalent to VBA6, VBA7, VB.NET, or VBS. If your question is specifically about programming any MS Office application, also use the appropriate tag: [excel], [ms-access], [ms-word], [outlook], [powerpoint] or [ms-project].

Visual Basic for Applications (VBA) is an event-driven programming language which was first introduced by Microsoft in 1993 to give Excel 5.0 a more robust object-oriented language for writing macros and automating the use of Excel. The language and its runtime quickly matured and began being used in products beyond Microsoft Office applications.

Differences between VBA 6.0 and VBA 7.0?

There's not a whole lot that has changed between VBA6 and VBA7. VBA7 was introduced to support 64-bit versions of both Office and Windows (see below on what those differences are). Here are the key changes:

  1. 64-bit support, primarily for API calls. This is both used to make your code work with your OS/Office version as well as others' (i.e. someone on Office 2003/WinXP)

    • If you are on a 64-bit version of Windows, but are on a 32-bit version of Office, you can declare API calls like below. .

      #If Win64 Then
          Declare PtrSafe Function GetTickCount64 Lib "kernel32"() As LongLong
      #Else
          Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long
      #End If
    • If you are on a 64-bit version of Windows, and are on a 64-bit version of Office, you can declare API calls like: .

      #If VBA7 Then
         Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" ( _
             ByVal lpClassName As String, _
             ByVal lpWindowName As String) As LongPtr
       #Else
         Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
             lpClassName As String, ByVal lpWindowName As String) As Long
      #End If
  2. To support this, there are:

    • Three new keywords (2 data types and 1 modifier): LongPtr, LongLong and PtrSafe

    • One new function: CLngLng() (i.e. Int64)

    • The new compilation constants as used above: VBA7 and Win64

Reference

Differences between VBA 6.0 and VBA 7.0

308 questions
0
votes
1 answer

Commulative function in sequences Cells in the same row

The code (with the SumOffset1) works perfectly and gives the correct result in the cell(5,2) running the function which it starts from the cell(3,3).Could you please help me how to modify the function so as to get the correct result in the cell(5,3)…
0
votes
0 answers

Commulative in sequences Cells in the same row

The below code (with the SumOffset1 Function) works perfectly and gives the result in the Cell (5,2) correctly. How can I continue the same Loop giving the correct result in the {Cell (5,2) (by using the sum function starts from the cell(3,3)}, then…
0
votes
1 answer

Trying to cut and paste data from todays date into a new sheet with VBA

Have code that generates an output with both today's date as well as the previous date run, i am trying to find a code that would select all information with today's date as the timestamp cut it and paste it into a new sheet. Example of points on…
0
votes
0 answers

VBA code to split data into multiple workbooks based on a column and transpose and merge data in each workbook

I am a beginner in VBA and I have a requirement where I need to split data from a source worksheet into multiple workbooks based on a specific column (Order Number), and then transpose and merge data in each workbook. Here are the details of my…
Deepak
  • 1
  • 2
0
votes
0 answers

searching Japanese string (Japanese text) in text file (.txt) and get match line number and complete line value (complete line text)

I have Excel VBA code which search a string (English text) in text file (.txt/notepad) and then gives me the line number and complete value of line of matched result. The code works perfectly fine for all the files which are in English. but I want…
Gaurav
  • 1
  • 3
0
votes
0 answers

In Excel VBA code use Thunderbird to send email, not Outlook

How do I set Eapp object to Thunderbird and not Outlook? I am able to automate emailing a PDF of a newly created Excel file (invoice) from within Excel using VBA.The the email client is Outlook but client prefers to mail with Thunderbird. I have not…
0
votes
0 answers

downloader.autdwnlrner/w97m and VBA.Heur.SDownloader.2.4E2AC9F2.Gen Detected on my VBA code

I have this VBA code that works perfectly but the problem I have is the code been detected by Major antivirus when scanned on Virustotal.com. Its a 52% detection rate which is very poor. From the scan result, major antivirus as detecting…
0
votes
0 answers

Keyboard Shortcut Macro for ScreenCapture into current MS-Word document not working

I used the MS-Word VBA macro recorder to create a screenshot shortcut macro in MS-Word 2016 / Word 365. The problem with the Windows 10 Pro Snipping Tool is that it creates its own window that gets in the way and requires an extra couple of steps…
Rich Lysakowski PhD
  • 2,702
  • 31
  • 44
0
votes
0 answers

Paste text from slide number placeholder on PowerPoint slide into Word

I am trying to copy three things from a PowerPoint slide and paste them into Word (using a VBA Marco in PowerPoint): 1) Slide number, 2) Thumbnail image of the slide, and 3) the Slide notes. I'm able to grab the slide notes by using Placeholders(2),…
PMPM2000
  • 3
  • 3
0
votes
0 answers

How to retrieve local file paths in Excel 365 using VBA SendKeys?

I have one Excel workbook thats is sync local and online, if a open with onedrive running my excel reconize this workbook how online file, the excel 365 has a option (file>information>copy local path) if a file is also save local. SendKeys "%ail~" …
0
votes
0 answers

VBA: Run-time error "Input past end of file" when reading some text files

I make use of the typical INPUT and LOF statement to read in large textiles. Some text file are 100MB and gets read in with no problem. Other smaller files give the error as in the title. VBA (Excel) 'Open file and read all lines in as strings …
0
votes
1 answer

Using replace function for this code instead of delete

I have created a user form for data entry and all entries shows in a list box , im still new to this so bare with me. when I select a line from the List and click delete, I want it to replace the values with "XXX' instead of delete row so that I…
0
votes
0 answers

Is there a syntax that can open a FORM1 in the background and populate 3 to 4 controls of same FORM1 with the same data as another open FORM2?

I have a database with three forms among others. FORM1 has 4 comboboxes that are partly used to populate FORM2. (Comboboxes A, B, C, D) Wnen FORM2 is opened and entries are made, saved and closed. I want users to be able to open FORM3 which has 3…
Datamint
  • 3
  • 3
0
votes
0 answers

Solution Required to compile sheets in a workbook while giving specific sheet name criteria

I want a VBA code solution in which i compile sheets available in one workbook while giving sheet name create as "US" because those target sheets which i want to compile are having "US" in sheetname. Situation: if i add new sheets then as per below…
Ashu Raj
  • 31
  • 2
0
votes
0 answers

I want to send automatic reply. but the reply should be just sent to person who was mentioned in to: in the recieved mail

I have written rule in my oulook to dump certain kind of messages in a specific folder. I want some mechanism to sent a acknowledgement message to the person who is mentioned as to: in the mails that are recieved to me in that folder I was looking…
Orion
  • 1