Hello- Can anyone explain how to record a macro. I went to Help and followed the instructions, but it does not work. I am using a Command Button to try and open a spreadsheet then put it in a module. Thanks! -- Denise Payne WPB FL
Is this in Word or Excel? If the latter, it would be better to post to microsoft.public.excel.programming. Aside from that, you should explain exactly what you want to achieve. What exactly do you mean by "putting a spreadsheet into a module"? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Denise Payne" wrote in message news:AD258A37-CB74-4A04-A494-9821CF71351F@microsoft.com... > Hello- > Can anyone explain how to record a macro. I went to Help and followed the > instructions, but it does not work. I am using a Command Button to try and > open a spreadsheet then put it in a module. > Thanks! > > -- > Denise Payne > WPB FL
I am using Excel. What I am trying to do is use a Command Button to link to a macro that will open a speadsheet from another file(Spreadsheet 1), then update another spreadsheet(Spreadsheet 2) from the first spreadsheet. Then, close everything. It is modeling data and there are 4323 rows and 50 columns. I am trying to create a command on one spreadsheet that will update the data at the touch of a button. -- Denise Payne "Doug Robbins - Word MVP" wrote: > Is this in Word or Excel? If the latter, it would be better to post to > microsoft.public.excel.programming. > > Aside from that, you should explain exactly what you want to achieve. What > exactly do you mean by "putting a spreadsheet into a module"? > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP > > "Denise Payne" wrote in message > news:AD258A37-CB74-4A04-A494-9821CF71351F@microsoft.com... > > Hello- > > Can anyone explain how to record a macro. I went to Help and followed the > > instructions, but it does not work. I am using a Command Button to try and > > open a spreadsheet then put it in a module. > > Thanks! > > > > -- > > Denise Payne > > WPB FL > > >
This forum is for Word vba - Excel has its own programming forums. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Denise Payne wrote: > I am using Excel. > What I am trying to do is use a Command Button to link to a macro > that will open a speadsheet from another file(Spreadsheet 1), then > update another spreadsheet(Spreadsheet 2) from the first spreadsheet. > Then, close everything. It is modeling data and there are 4323 rows > and 50 columns. I am trying to create a command on one spreadsheet > that will update the data at the touch of a button. > >> Is this in Word or Excel? If the latter, it would be better to post >> to microsoft.public.excel.programming. >> >> Aside from that, you should explain exactly what you want to >> achieve. What exactly do you mean by "putting a spreadsheet into a >> module"? >> >> -- >> Hope this helps. >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> services on a paid consulting basis. >> >> Doug Robbins - Word MVP >> >> "Denise Payne" wrote in message >> news:AD258A37-CB74-4A04-A494-9821CF71351F@microsoft.com... >>> Hello- >>> Can anyone explain how to record a macro. I went to Help and >>> followed the instructions, but it does not work. I am using a >>> Command Button to try and open a spreadsheet then put it in a >>> module. >>> Thanks! >>> >>> -- >>> Denise Payne >>> WPB FL
Hi Denise, You should really have posted this in an NG like microsoft.public.excel.programming, but here's some code you could use. It includes a variety of error checks before trying to open the file: Option Explicit Dim wbFullName As String Function IsLocked(wbFullName As String) As Boolean On Error Resume Next Open wbFullName For Binary Access Read Write Lock Read Write As #1 Close #1 IsFileOpen = Err.Number Err.Clear End Function Sub OpenWorkbook() Dim wbName As String Dim wbPath As String wbPath = "c:\data\" wbName = "test.xls" wbFullName = wbPath & wbName If Dir(wbFullName) = "" Then MsgBox "Cannot find: " & wbFullName ElseIf Not Workbooks(wbName) Is Nothing Then MsgBox "The file: " & wbFullName & " is already open!" ElseIf IsLocked(wbFullName) Then MsgBox "The file: " & wbFullName & " is in use by another user!" Else Workbooks.Open wbFullName End If End Sub Simply change the path & filename to suit your needs. -- Cheers macropod [MVP - Microsoft Word] "Denise Payne" wrote in message news:23B85C57-0834-4360-9F97-2A03B354E83E@microsoft.com... >I am using Excel. > What I am trying to do is use a Command Button to link to a macro that will > open a speadsheet from another file(Spreadsheet 1), then update another > spreadsheet(Spreadsheet 2) from the first spreadsheet. Then, close > everything. It is modeling data and there are 4323 rows and 50 columns. I am > trying to create a command on one spreadsheet that will update the data at > the touch of a button. > -- > Denise Payne > > > "Doug Robbins - Word MVP" wrote: > >> Is this in Word or Excel? If the latter, it would be better to post to >> microsoft.public.excel.programming. >> >> Aside from that, you should explain exactly what you want to achieve. What >> exactly do you mean by "putting a spreadsheet into a module"? >> >> -- >> Hope this helps. >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> services on a paid consulting basis. >> >> Doug Robbins - Word MVP >> >> "Denise Payne" wrote in message >> news:AD258A37-CB74-4A04-A494-9821CF71351F@microsoft.com... >> > Hello- >> > Can anyone explain how to record a macro. I went to Help and followed the >> > instructions, but it does not work. I am using a Command Button to try and >> > open a spreadsheet then put it in a module. >> > Thanks! >> > >> > -- >> > Denise Payne >> > WPB FL >> >> >>