Search:

Type: Posts; User: John_w; Keyword(s):

Page 1 of 6 1 2 3 4

Search: Search took 0.27 seconds.

  1. Replies
    2
    Views
    40

    Re: Open 2 Matching Files in Folder & Loop

    You can't have 2 Dir calls in the same loop because the 2nd Dir call loses the context of the 1st Dir call. The solution is to have a more general wildcard filespec for the Dir loop and put the...
  2. Re: Copy data range to a dynamic target worksheet and range

    In that case we can use your idea of reading the required month from a cell. In this code, cell A2 in sheet "Macro set up" in the macro workbook is expected to contain any date in the required month...
  3. Re: search folder for latest file creation date, not latest modified date

    We have to use FileSystemObject to determine a file's creation date. Add this function:


    Public Function Get_Latest_Workbook(searchPath As String) As String

    Dim FSO As Object
    Dim...
  4. Thread: Auto-Save issue

    by John_w
    Replies
    2
    Views
    56

    Re: Auto-Save issue

    The problem is that your Workbook_Open calls OnTime without saving the time in the dTime variable, so if you close the workbook within 2 minutes of opening it the AutoDeactivate routine doesn't...
  5. Replies
    4
    Views
    113

    Re: Email Code to Email Active XLSX sheet

    Try this macro:

    Public Sub Email_Active_Sheet()

    Dim wb As Workbook
    Dim p As Long, tempWorkbookFullName As String
    Dim emailSubject As String
    Dim oApp As Object, oMail As...
  6. Re: Copy data range to a dynamic target worksheet and range

    These file names are not consistent - the first has 4 letters for the month and the year is specified, whereas the second has 3 letters for the month and no year.

    With the file names as Sep...
  7. Re: VBA saving tab in new workbook but button linked to old

    You have to change the button's OnAction property in the new workbook to include the full name of the new workbook. For example:

    Public Sub Save_Sheet()

    Dim clickedButton As Button
    Dim...
  8. Replies
    1
    Views
    95

    Re: Changing Font Type in Header VBA Code

    Try this:

    .PageSetup.RightHeader = "&""Times New Roman,Regular"" " & Format(Now, "YYYY") & " " & prevQtr & qtrEndingDate
    If you want an explicit font size (e.g. 8):

    ...
  9. Re: Using UIAutomationClient to automate the Save As file download in IE11

    UPDATE - Here is a list of useful links for UI Automation:

    UI Automation introduction
    https://docs.microsoft.com/en-gb/windows/desktop/WinAuto/entry-uiauto-win32

    UI Automation Fundamentals...
  10. Replies
    3
    Views
    130

    Re: printing userform landscape and on a4

    What have you tried?

    There are some ideas in http://www.mrexcel.com/forum/excel-questions/331211-save-userform-bmp.html, including a couple of linked pages.
  11. Replies
    3
    Views
    100

    Re: Showing .pdf file in folder with my code

    This can be done with the Shell BrowseForFolder method and specifying the BIF_BROWSEINCLUDEFILES flag so that the browser displays files and folders.

    Add this code to a new module:

    Option...
  12. Replies
    12
    Views
    241

    Re: VBA - get active printer status

    Add Dim statements. Data types should be obvious from the variable names - str is String, obj is Object, etc.

    I don't know about the active printer. Perhaps there is a property at...
  13. Replies
    10
    Views
    189

    Re: VBA table TotalsRowRange cells

    Try this:

    With myTable
    .TotalsRowRange(.ListColumns("Stake").Index).Select
    End With
  14. Replies
    12
    Views
    241

    Re: VBA - get active printer status

    That code is VBScript - change every Wscript.Echo to Debug.Print for VBA. You'll also need to declare the variables if you're using Option Explicit.
  15. Replies
    12
    Views
    241

    Re: VBA - get active printer status

    You can use WMI - https://www.pcreview.co.uk/threads/is-wmi-printerstatus-in-win32_printer-reliable.2434571/
  16. Re: VBA to fill array with delimited data from text file

    Your thread title and initial code is at odds with your overall aim, and the code posted so far will only import the data from one text file.

    This macro effectively uses the Text Import Wizard to...
  17. Replies
    3
    Views
    85

    Re: Auto Creation of Folders in .pst File

    You have to add the .pst file as a Store to Outlook (temporarily) and then you can add the new folder to the Store.

    Try this macro:

    Public Sub Add_Folder_To_pst_File()

    Dim outApp As...
  18. Re: VBA to refresh power query then resume macro once the refresh is done

    The Connection.OLEDBConnection object is defined only if the connection type for that connection is OLEDB. Therefore change the loop to:

    For Each Connection In...
  19. Re: VBA to fill array with delimited data from text file

    Swap the row and column dimensions in the ReDim Preserve, like this:

    ReDim Preserve DataArray(rw, col)
  20. Re: Import each Email from outlook into the next row of excel

    Untested. As well as the Offset change, replace:

    Range("Body_of_Email").Offset(1, 0).Value = OutlookMail.Bodywith:

    Dim lines As Variant, r As Long
    lines = Split(OutlookMail.Body, vbCrLf)
    For...
  21. Re: VBA to fill array with delimited data from text file

    Untested; try changing:

    DataArray(y, rw) = TempArray(y)to:

    DataArray(rw, y) = TempArray(y)
  22. Re: Using UIAutomationClient to automate the Save As file download in IE11

    Update

    I have come across some websites where, when a file download is offered, IE11 displays a dialogue asking "What do you want to do with xxxxx.xxx?", instead of the normal Download...
  23. Replies
    9
    Views
    448

    Re: Navigate and getting data from website

    You are correct: it doesn't display the normal Download Notification Bar at the bottom of the IE window, but a "What do you want to do with xxxxx.xxx?" dialogue:

    https://i.imgur.com/IuDNX5n.png
    ...
  24. Replies
    6
    Views
    168

    Re: VBA Sub BetweenDates

    Try this:

    Sub BTWDates2()

    Dim i As Variant
    Dim cell As Range
    Dim sDate1 As Date
    Dim sDate2 As Date
    sDate1 = #10/1/2019#
    sDate2 = #9/30/2020#
  25. Replies
    6
    Views
    168

    Re: VBA Sub BetweenDates

    Add an If ... End If block:

    If d <> Empty Then

    End If
    around the Select ... End Select block.
Results 1 to 25 of 150
Page 1 of 6 1 2 3 4