Networking properties?

Discussion in 'AutoCAD' started by KyDeano, Oct 21, 2004.

  1. KyDeano

    KyDeano Guest

    Hi all, I have a project i need serious help with and not sure were i'm messing up. I'll try to post it without going too laborious with it.

    I'm using a call modnetuse.connect to map drive "W:" to a directory on a networked PC using a login name and password other than mine. The drive is mapped fine. However, when I try to pull a file from that directory it is unable to do it.

    scenario: I do not have access to the directory but the user that I logged in as with the password in the call modnetuse.connect feature does have full control access.

    If i'm running inside the same macro that I called the mapping in, shouldn't it try to access the files on the PC using the login name i passed when mapping that drive so that i'm able to get the file?

    Or does the macro not care and wen i call for that file it's still going to use my login when trying to access it even though the drive was mapped using a valid login name.

    I know i didnt portray this question in a manner that really points out what i'm trying to do, but hopefully it will start something and might get me where i need to go.

    Which is being able to pass a mapping with a valid login name other than mine and get access to the files i need.

    Thanks in advance!!!!

    Deano
     
    KyDeano, Oct 21, 2004
    #1
  2. Post your code.
     
    Frank Oquendo, Oct 22, 2004
    #2
  3. KyDeano

    KyDeano Guest

    Sorry not sooner Frank, I went on Vacation. Here is most of the code and I think I may know what could be wrong. But I'll still post and see.

    Part one here is the login button

    Private Sub CommandButton5_Click()
    On Error GoTo badfile
    company = "company1"
    Call ModNetUse.Connect("\\company1\FolderShared", "W:", "Username", "password")
    If (ModNetUse.rc <> 0) And (ModNetUse.rc <> 85) Then
    MsgBox ModNetUse.ErrorMsg
    ''' generic network capture for space '''
    GoTo badfile
    End If
    Label143.Visible = False
    UserForm2.Repaint
    Set xlobj = CreateObject("excel.Application")
    xlobj.Workbooks.Open ("W:\SharedFiles\File.xls")
    xlobj.Visible = False
    Set xlsht = xlobj.Sheets("Sheet1")
    Set xlsht2 = xlobj.Sheets("Sheet2")
    xlsht.Select
    CommandButton5.Enabled = False
    CommandButton4.Enabled = True
    CommandButton6.Enabled = True
    CommandButton7.Enabled = True
    CommandButton8.Enabled = False
    SwRefresh
    Label143.Visible = False
    UserForm2.Repaint
    Exit Sub
    badfile:
    Set xlobj = Nothing
    Label143.Visible = False
    UserForm2.Repaint
    End Sub

    --- end part one

    Part two here is the create button

    Private Sub CommandButton6_Click()
    On Error GoTo nocreate
    Label143.Visible = True
    UserForm2.Repaint
    xlobj.Run "Macro1"
    ctr = 1
    Do Until ctr = 10000000
    ctr = ctr + 1
    Loop
    UserForm2.Hide
    ThisDrawing.SendCommand ("(command ""_DXFIN"" ""W:\\Drawings\\" + Drawing.Text + ".dxf"")" & Chr(32))
    ThisDrawing.SaveAs ("I:\xrefs\" + Drawing.Text + "xref.dwg")
    ThisDrawing.SendCommand ("(command ""ERASE"" ""all"")" & Chr(32) & Chr(32))
    ThisDrawing.SaveAs ("C:\eraseme.dwg")
    If Dir("I:\NewDwg\" + Drawing.Text + ".dwg") <> nil Then
    Unload UserForm2
    MsgBox ("Existing File has been updated!!!")
    Else
    If company = "company1" Then
    ThisDrawing.SendCommand ("(command ""_XREF"" ""_A"" ""I:\\xrefs\\" + Drawing.Text + "xref.dwg"" ""0"" ""1"" ""1"" ""0"")" & Chr(32))
    Else
    ThisDrawing.SendCommand ("(command ""_XREF"" ""_A"" ""I:\\xrefs\\" + Drawing.Text + "xref.dwg"" ""0"" ""1"" ""1"" ""0"")" & Chr(32))
    End If
    ThisDrawing.SaveAs ("I:\AMEP\" + Drawing.Text + ".dwg")
    ThisDrawing.SendCommand ("(command ""ERASE"" ""all"")" & Chr(32) & Chr(32))
    ThisDrawing.SaveAs ("C:\eraseme.dwg")
    Unload UserForm2
    MsgBox ("New File has been created!!!")
    End If
    xlobj.Workbooks("File.xls").Close False
    Set resp = Nothing
    Set xlsht2 = Nothing
    Set xlsht = Nothing
    xlobj.Quit
    Set xlobj = Nothing
    Call ModNetUse.DisConnect("W:", True)
    If (ModNetUse.rc <> 0) And (ModNetUse.rc <> 85) Then
    MsgBox ModNetUse.ErrorMsg
    End If
    End
    nocreate:
    MsgBox ("Error..... File could not be created, Contact Admin!!!")
    Label143.Visible = False
    UserForm2.Repaint
    End Sub

    --- end part two

    It appears to me that what might be the problem is that the Macro that is running in Excel is where the files are being opened and shut so the login being used inside the Autocad macro isnt issueing the rights. So the Excel macro is running off the user that is logged into the PC at that time and not the user issued in the cad macro.

    Am I on the right track or does this not really even matter. It still cant be done?

    Thanks again!!!!!

    Deano
     
    KyDeano, Oct 27, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.