Apple Mac File Path


Board Regular
Dec 17, 2008
Hi all, I'm working on a spreadsheet for a friend who uses a Mac. I have zero experience on a Mac so I'm hoping I could get some help please.

The below code works on my PC but it fails on his Mac:

Sub ImportRawReport()

    Application.ScreenUpdating = False

    Dim fd As Office.FileDialog
    Set fd = Application.FileDialog(msoFileDialogFilePicker)

    With fd
         .Title = "Select Raw Tx Report"        
        .AllowMultiSelect = False        
        .InitialFileName = "H:\Misc\Projects\Raw File\"
    Dim sFile As String
        If .Show = True Then
            sFile = .SelectedItems(1)
        End If
    Dim wbkS As Workbook
    Dim wshS As Worksheet

        Set wbkS = Workbooks.Open(Filename:=sFile)
        Set wshS = wbkS.Sheets("Raw Tx Report")
        wshS.UsedRange.Copy Destination:=Sheet7.Range("A1")
        wbkS.Close 'SaveChanges:=False
        Set wbkS = Nothing
        Set wshS = Nothing
    End With
    Dim Arr As Variant
    Dim Rng As Range
    Dim i As Long
    Arr = Array(xlCellTypeBlanks, xlCellTypeConstants)
    For i = 0 To UBound(Arr)
    Set Rng = Columns("B:B").SpecialCells(Arr(i), 22)
        If Not Rng Is Nothing Then
        End If
    Next i
    Sheets("RawReport").Cells(Rows.Count, 1).End(xlUp).EntireRow.Delete
    MsgBox "BMC raw report has been updloaded", , "BMC"
    Application.ScreenUpdating = True

End Sub
The error message I'm getting is "Run-time error '91': Object variable or With block variable not set"

When I click on Debug, it points to the ".Title = "Select Raw Tx Report" part of the code.

The file path also needs to change for his Mac, but I'm unsure how to translate this on the code. I'm also not sure what the new path format will be as I have found two versions:


iCloud Drive/Documents/BMC/

I believe he's using Mac Office 365 if that is any help.

Thanks in advance.

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...