Search:

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

Page 1 of 6 1 2 3 4

Search: Search took 0.33 seconds.

  1. Replies
    1
    Views
    35

    Re: Email PDF code - save a copy

    Replace:
    PdfFile = ActiveWorkbook.FullName
    i = InStrRev(PdfFile, ".")
    If i > 1 Then PdfFile = Left(PdfFile, i - 1)
    PdfFile = PdfFile & "_" & ActiveSheet.Name & ".pdf"
    with:

    PdfFile =...
  2. Replies
    11
    Views
    339

    Re: Image in Footer via VBA

    The additional code was just what the macro recorder generated. Try it with DrawingObjects:=False.
  3. Re: VBA - PowerShell stdOut and waitOnReturn Required

    Try using Run and the PowerShell redirection operator (>) or the -Out-File cmdlet to redirect the output to a file and read that file:

    Sub Test()

    Dim wsh As Object
    Set wsh =...
  4. Re: Some help with a last modified date/time problem

    Right-click the sheet's tab and click View Code. Put this code in the right-hand pane:


    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    ...
  5. Re: VBA to copy sheets & rename to workbookname

    Try the macro at http://www.mrexcel.com/forum/excel-questions/733233-visual-basic-applications-script-copy-multiple-excel-files-into-one-excel-file-putting-them-into-mult-tabs.html
  6. Replies
    11
    Views
    339

    Re: Image in Footer via VBA

    We just need to unprotect and reprotect the sheet, specifying the password (e.g. "123") if you have set one. If you haven't set a password then omit the Password parameter.


    Public Sub...
  7. Re: SQL Insert Statement > Start Insert Records from Row(3) and onwards

    I'm not sure if this macro will do exactly what you require, or whether I've completely understood, because you haven't given any details about your Access table (e.g. the Req_Key column, which I...
  8. Replies
    1
    Views
    57

    Re: Sheet prints twice

    Try deleting the first line - that will print if you click OK on the dialogue.
  9. Replies
    11
    Views
    339

    Re: Image in Footer via VBA

    Yes, simply repeat the code in the Workbook_BeforePrint handler. Better still, put the code in a new subroutine and call it from Workbook_BeforeSave and Workbook_BeforePrint.

    Add this to the...
  10. Replies
    11
    Views
    339

    Re: Image in Footer via VBA

    Try changing:

    tempImage = ThisWorkbook.Path & "\" & ws.Pictures(1).Name & ".jpg"
    to:

    tempImage = Environ("temp") & "\" & ws.Pictures(1).Name & ".jpg"
  11. Re: Search For File In Directory Using Wildcard Works, But Now To Get The Complete Name Of That File

    Yes, OP you need to define the srcpath string, assuming it isn't a global variable defined elsewhere. I advise you to always have Option Explicit at the top of modules.

    Dir returns a complete...
  12. Replies
    4
    Views
    99

    Re: Open and space two folders

    The size and position of the windows are specified in screen pixels in the Place_Window arguments:


    Private Sub Place_Window(hWnd As LongPtr, left As Long, top As Long, width As Long, height As...
  13. Re: Search For File In Directory Using Wildcard Works, But Now To Get The Complete Name Of That File

    strFileExists is the actual file name returned by Dir, so you need to prepend the path to open it:

    strFileExists = Dir(strFileName)

    If strFileExists = "" Then
    ...
  14. Replies
    11
    Views
    1,790

    Re: Save Excel worksheet as PDF

    "/" isn't valid in file names because it separates folder names. This code replaces "/" with "_":

    fname = Replace(Sheets(1).Range("I8"), "/", "_") & " - " & _
    Sheets(1).Range("A11")...
  15. Replies
    5
    Views
    163

    Re: File save as location

    If you don't specify a folder path on the SaveAs then it saves it in some default location. Try this with an explicit path and FileFormat:=xlOpenXMLWorkbook on the SaveAs line:


    Sub...
  16. Replies
    11
    Views
    339

    Re: Image in Footer via VBA

    Not totally clear from your posts, but it seems you have a Picture on each sheet and you want each Picture to appear in the sheet's footer when the workbook is saved.

    The .FileName property must...
  17. Replies
    11
    Views
    1,790

    Re: Save Excel worksheet as PDF

    Yes, but what is the actual value? Give examples - I want to see if it's a valid file name.
  18. Replies
    5
    Views
    163

    Re: File save as location

    I don't understand your first question - it's not clear where you want the copies saved. For your second question, use Application.DisplayAlerts = False to suppress the prompt.

    Try this macro:
    ...
  19. Replies
    11
    Views
    1,790

    Re: Save Excel worksheet as PDF

    What is the value of fName from the cells?
  20. Replies
    11
    Views
    1,790

    Re: Save Excel worksheet as PDF

    Is fName a valid file name? Does it end with ".pdf"?

    Try it with a fixed file name:

    fName = "Test.pdf"
  21. Replies
    3
    Views
    53

    Re: Copying files to specific folder

    Try these changes (untested etc.)

    If Right(destinationPath , 1) <> "\" Then destinationPath = destinationPath & "\"


    'delete existing files
    fso.DeleteFile(destinationPath & "*.txt"), TrueThe...
  22. Replies
    11
    Views
    1,790

    Re: Save Excel worksheet as PDF

    Try adding a back slash at the end of the fPath string.
  23. Re: A convenient way to batch rename ( not caption ) multiple command buttons on Userform ?

    See https://www.tek-tips.com/viewthread.cfm?qid=1286170

    The code might need tweaking for more recent Excel versions and the particular way you want to rename the buttons. Note that it also...
  24. Re: Does A Variation Of A Filename Exist In A Directory

    Maybe you didn't know, but asterisk is a wildcard character in the Dir function, representing 0 or more characters. So your code, as posted, should determine whether any of the three variations...
  25. Replies
    4
    Views
    99

    Re: Open and space two folders

    The forum software has removed the back slashes from the Get_Explorer_hWnd function. Here is the function with BACK SLASH in place of them, which you must replace with a back slash character.

    ...
Results 1 to 25 of 150
Page 1 of 6 1 2 3 4