spath

  1. R

    Environ use (blackslash vs. forward slash)

    So I have a question on the use of Environ function in VBA. If I want to open a file from my desktop, it appears I need to use forward slashes instead of backslashes? Is this correct? Is there a forward slash version on Environ? Private Sub PortConvey_Click() Dim sPath As String 'MTS...
  2. P

    Compile error: Invalid or unqualified reference and For Loop Doesn't Loop

    I have a userform with six option buttons and and three textboxes. I would like the code to loop through column G until it finds the first value that equals the value of textbox 3 then offset back three cells and check if that value equals the value in textbox1. Whether it contains the value or...
  3. P

    Runtime Error 91 Object variable or with block variable not set

    On my userform, I have six option buttons and three textboxes. When I run this code I get the following runtime error '91. Option Explicit Dim sPath As String, sFile As String Dim wb As Workbook Dim ws As Worksheet Dim rng As Range Private Sub cmdbtnOpen_Click() sPath =...
  4. H

    Cancel Button When Importing File

    I'm using the following code to import a another file, I thought I fixed the issue of getting a runtime error, but now it doesn't open the selected file and I get the MSG Box. Dim sPath As String Dim sFile Dim ws1 As Worksheet Set ws1 = Sheet1 sPath = "\\Address\Folder1\Folder2\Folder3" &...
  5. G

    Drag and drop emails into vba userform

    Hi, I'm looking for some help, I want to ultimately create an area where I can drag emails into a window within a user form, and then they get automatically copied to a specified directory. I have been trying for days and searched the web but fail every time. I have the following using...
  6. M

    Save as New Workbook, Let User specify Folder. Name file using cell value and todays date.

    Hi there I thought I found what I needed (almost). I want to save the current file as 1) new workbook 2) user should specify their file path folder 3) name of file should read from Sheet11.Range("C9") (which is also a named range if easier in case it moves) =Table13[Country] + "MOVE Template"...
  7. K

    Need help on converting a batch of txt to excel using VBA

    I was trying to batch convert text files to excel using VBA and found this code in this web. This is how my text looks like: ABC|123|DEF ZZZ|233|YTU HHH|789|HJK <code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch...
  8. L

    VBA to continue automatically when opening files

    Our code (I copied it and tweaked it from another vba forum) goes out to @ 200 files in a folder and copies a single row into 1 sheet - works great But Rather than putting in code to tell it to Don't UpdateLinks or Don't Ask and then getting a second prompt, is there code to tell it to Don't...
  9. P

    Run-time error '91' Help

    All I am trying to do is see if there is a worksheet named (page 2) or a worksheet named (Exhibit "I"), if there is then call Sub deleteWS. However I am getting a Runtime error: 91 on the Bold Print and underlined ws.Name. Not sure what I coded incorrectly. By the way, I recorded a macro to get...
  10. P

    How to copy a every part of a worksheet

    There is a worksheet inside a workbook located on server that I need to copy. The problem that I am stuck on is how to copy all the contents of the page including the header content, footer content, and margin settings(Top,Left, Bottom, Footer,Right, and Header) of the selection using VBA. Here...
  11. N

    How would I create folder by date and then, inside that, folders by cell value?

    I have a call to macro that creates a folder by date: Dim sPath As StringsPath = "M:\Lvl3-5Mgrs\"If Len(Dir(sPath & Format(Date, "yyyy_mm_dd"), vbDirectory)) = 0 Then MkDir (sPath & Format(Date, "yyyy_mm_dd"))End If and then I want to create folders in that by Executive manager (not working...
  12. H

    extract email address based on name of file attached

    I have names of various workbooks in Col A and the email address to cc on col B pertaining to the file name I have the following code below to email and allow a user to attach a file Based on the name file attached, I would like the code to look up the email address to cc in Col B based on...
  13. I

    Compile error "Subscript out of range" in simple set statement

    I'm obviously missing a fundamental concept. I have reduced my problem down to a few lines of code, and still can't solve it. Sub tstSbScrptRng() Dim wkBk As Workbook Dim sPath As String Dim sFile As String sPath = "C:\Users\ibud0\Documents\" sFile = "Garbage.xlsx"...
  14. S

    Data Grab from Closed Workbooks - Cell Reference Bug?

    So I am attempting to pull a LOT of cells from closed workbooks in a folder, I know it works on a small scale.. but when I put in this many cells it doesn't. Here is the code. Sub OpenFile() Dim sPath As String Dim sFil As String Dim strName As String Dim twbk As Workbook Dim...
  15. S

    More Specific Data-Pull Code

    Hey all, so I'm working with the following code to pull information from all workbooks in a folder. Sub OpenFile() Dim sPath As String Dim sFil As String Dim strName As String Dim twbk As Workbook Dim owbk As Workbook Dim ws As Worksheet Set twbk =...
  16. A

    VBA in MS Outlook to save messages in a newly created folder

    I'm trying to assign a VBA script in MS Outlook so that I can get all emails saved in a newly created folder (named by date, files also named by date). I create a folder and assign name to it: strNewFolderName = Format(dtDate , "yyyymmdd", vbUseSystemDayOfWeek, _ vbUseSystem) sName =...
  17. R

    Creating Shortcut Sub-folders

    I need help as I have zero experience in VBA. I have two columns of data, I am creating a folder titled Column A and a subfolder titled Column B. Now I want to take the name of the subfolder and search for it's corresponding project folder and replace the subfolder with a shortcuts folder to...
  18. M

    VBA to create an email with file path

    Hi all, I've got a macro that saves my report to a certain drive with a name based on some variables. Is it easy to input some VBA to create an email with the just the file path and send to joebloggs@123.com? This is the code at the end of my macro that saves the file to the location that I...
  19. R

    VBA code to open most recent file saved in folder (Network UNC Folder)

    Hi, I have an Excel file where users select the most recent version of a file in a network folder and import it. I would like to automate this step so that the macro automatically imports the most recent file. I have tried to incorporate the code from this answer but cannot figure out the...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top