Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    swenger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    151
    Code:
    Option Compare Database
    Option Explicit
    
    Private Const BIF_RETURNONLYFSDIRS As Long = &H1
    Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2
    Private Const BIF_RETURNFSANCESTORS As Long = &H8
    Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000
    Private Const BIF_BROWSEFORPRINTER As Long = &H2000
    Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000
    Private Const MAX_PATH As Long = 260
    Code:
    Function BrowseFolder(Optional Caption As String, _
        Optional InitialFolder As String) As String
    
    Dim SH As Shell32.Shell
    Dim F As Shell32.Folder
    
    Set SH = New Shell32.Shell
    Set F = SH.BrowseForFolder(0&, Caption, BIF_RETURNONLYFSDIRS, InitialFolder)
    If Not F Is Nothing Then
        BrowseFolder = F.Items.Item.path
    End If
    
    End Function



    Code:
    Private Sub Label_Click()
    On Error GoTo Label_Click_Err
    
    Dim FName As String
       FName = BrowseFolder(Caption:="Select A Folder", InitialFolder:="C:\")
            If FName = vbNullString Then
                Debug.Print "No folder selected."
            Else
                Debug.Print "Folder Selected: " & FName
            End If
    
        If Right(FName, 1) = "\" Then
            Sbj = FName & "Label for RMA " & RMA & ".pdf"
        Else
            Sbj = FName & "\Label for RMA " & RMA & ".pdf"
        End If
    
        DoCmd.OutputTo acOutputReport, "RRMAInfo_Label", acFormatPDF, Sbj, , , , 0
    
    Label_Click_Exit:
        Exit Sub
    
    Label_Click_Err:
        MsgBox Error$
        Resume Label_Click_Exit
    End Sub

  2. #17
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    BEAUTIFUL POST!!! Now let me look at it.

  3. #18
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I still need to see a picture of your References. I get the following:
    Click image for larger version. 

Name:	ShellCapture.JPG 
Views:	7 
Size:	40.3 KB 
ID:	29629
    When I try and run it. That's the same as you. It does not like Shell (the 1st line of the procedure).

  4. #19
    swenger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    151
    Thank you. A light bulb just went off. Now I remember that I had to add the Microsoft Shell and Outlook in the references of the VBA. Somehow they must have gotten unchecked. Maybe an update or something. I just checked them and now it works.

    Click image for larger version. 

Name:	Capture.JPG 
Views:	6 
Size:	25.0 KB 
ID:	29630

  5. #20
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Yep! Mine started working too. Are you ready to mark this thread as Solved? Click the link in my signature to see how.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-22-2016, 05:05 AM
  2. Replies: 1
    Last Post: 07-26-2016, 06:34 AM
  3. Replies: 6
    Last Post: 03-17-2016, 02:10 PM
  4. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  5. Replies: 0
    Last Post: 07-16-2012, 05:42 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
  •  
Other Forums: Microsoft Office Forums